
<template>
  <div style="height:100%;width:100%;position:relative;">
      <div :class="isdialog ? 'pagetop2' : loadstyle ? 'pagetop' : 'pagetop1'" v-show="!isdialog">
          <!--顶部-->
          <table border="0" style="width:100%">
              <tr>
                  <td colspan="8" style="text-align:left;padding-left:22px">
                      <div style="color:red" id="hospname">
                          {{ hospitalname }}
                      </div>
                  </td>
              </tr>
              <tr>
                  <td v-if="SQLKEY == 'RU'">
                      <table class="table1style">
                          <tr>
                              <td>
                                  <font font-size="12px">单元</font>
                              </td>
                              <td>
                                  <rm-ddl-rptunit prgno="MNG133" @change="rptunitchange" v-model="rptunitval" width="200px" v-el-drag-dialog :appendtobody="true" :clearable="false" :close-on-click-modal="false" defaultflag="1"></rm-ddl-rptunit>
                              </td>
                          </tr>
                      </table>
                  </td>
                  <td v-if="SQLKEY == 'IS'">
                      <table class="table1style">
                          <tr>
                              <td>
                                  <font font-size="12px">检验仪器</font>
                              </td>
                              <td>
                                  <rm-ddl-instrument @change="labinstrumentchange" v-model="rptunitval" width="200px" v-el-drag-dialog :appendtobody="true" :close-on-click-modal="false" :clearable="false" defaultflag="1"></rm-ddl-instrument>
                              </td>
                          </tr>
                      </table>
                  </td>
                  <td v-if="SQLKEY == 'LG'">
                      <table class="table1style">
                          <tr>
                              <td>
                                  <font font-size="12px">检验组</font>
                              </td>
                              <td>
                                  <el-select v-model="rptunitval" @change="labgroupchange">
                                      <el-option v-for="(item,index) in labgroupOption" :key="index" :label="item.hidname" :value="item.hidkey"></el-option>
                                  </el-select>
                              </td>
                          </tr>
                      </table>
                  </td>
                  <td v-if="SQLKEY == 'INV'">
                      <table class="table1style">
                          <tr>
                              <td>
                                  <font font-size="12px" v-if="this.OptionClass != '本地'">采购中心</font>
                              </td>
                              <td>
                                  <el-select v-if="this.OptionClass != '本地'" v-model="rptunitval" disabled>
                                      <el-option v-for="(item,index) in invOrgOption" :key="index" :label="item.hidname" :value="item.hidkey"></el-option>
                                  </el-select>
                              </td>
                          </tr>
                      </table>
                  </td>
                  <td v-if="SQLKEY == 'DEV'">
                      <table class="table1style">
                          <tr>
                              <td>
                                  <font v-if="this.OptionClass != '本地'" font-size="12px">设备中心</font>
                              </td>
                              <td>
                                  <el-select v-if="this.OptionClass != '本地'" v-model="rptunitval" disabled>
                                      <el-option v-for="(item,index) in devOrgOption" :key="index" :label="item.hidname" :value="item.hidkey"></el-option>
                                  </el-select>
                              </td>
                          </tr>
                      </table>
                  </td>
                  <td v-if="SQLKEY == 'DEV191'">
                      <table class="table1style">
                          <tr>
                              <td>
                                  <!-- <font font-size="12px">设备中心</font> -->
                              </td>
                              <td>
                                  <!-- <el-select v-model="rptunitval" disabled>
                                      <el-option v-for="(item,index) in devOrgOption" :key="index" :label="item.hidname" :value="item.hidkey"></el-option>
                                  </el-select> -->
                              </td>
                          </tr>
                      </table>
                  </td>
                  <td v-if="SQLKEY == 'NBI'">
                      <table class="table1style">
                          <tr>
                              <td>
                                  <font font-size="12px">供血机构</font>
                              </td>
                              <td>
                                  <el-select v-model="rptunitval" @change="labgroupchange">
                                      <el-option v-for="(item,index) in bldorgoption" :key="index" :label="item.hidname" :value="item.hidkey"></el-option>
                                  </el-select>
                              </td>
                          </tr>
                      </table>
                  </td>

                  <td style="width:20px"></td>
                  <td>
                      <el-radio-group v-model="actionid">
                          <el-radio v-for="operate in optionkindOptions" :label="operate.actionid" :key="operate.actionid" @change="handleCheckedChange">
                              {{ operate.actionname }}
                          </el-radio>
                      </el-radio-group>
                  </td>
                  <td style="width:20px"></td>
                  <td align="right" style="width:180px">
                      <el-input v-model.trim="txtsearch" placeholder="输入选项代码或名称或序号" @keyup.enter.native="QSecOption" clearable></el-input>
                  </td>
                  <td align="right" style="width:85px" v-if="usrtype">
                      <el-dropdown trigger="click">
                          <span class="el-dropdown-link">
                              <el-button>
                                  默认值<i class="el-icon-caret-bottom el-icon--right"></i>
                              </el-button>
                          </span>
                          <el-dropdown-menu slot="dropdown">
                              <el-dropdown-item class="clearfix" @click.native="RadioDefaultValDialog(1, -1, -1)">
                                  恢复所有选项页的默认值
                              </el-dropdown-item>
                              <el-dropdown-item v-if="actionid != '查询专用标记'" class="clearfix" @click.native="RadioDefaultValDialog(2, -1, -1)">
                                  恢复当前页选项的默认值
                              </el-dropdown-item>
                          </el-dropdown-menu>
                      </el-dropdown>
                  </td>
                  <td v-if="SQLKEY == 'RU'">
                      <el-button @click.native="RptUnitBatchModify">批量修改</el-button>
                  </td>
              </tr>
          </table>
      </div>
      <div :class="isdialog ? 'pagecenter2' : loadstyle ? 'pagecenter' : 'pagecenter1'">
          <!--中部-->
          <rm-layout-left movingcolor="#0000ff" :fixsize="isdialog ? 0 : 250">
              <!--左边-->
              <template v-slot:fix>
                  <div class="left_nav">
                      <div v-for="(titem, tindex) in nArray" :class="currentIndex == tindex ? 'active' : ''" :key="tindex" @click="goAnchor(tindex)">
                          {{ titem.title }}
                      </div>
                  </div>
              </template>
              <div class="right_content" ref="ScrollMainContent">
                  <!--主体-->
                  <div>
                      <div v-for="(titem, tindex) in nArray" :key="tindex">
                          <!--标题-->
                          <div :id="'anchor-' + tindex" class="scroll_title" :class="{isActive: currentIndex == tindex}">
                              <table style="width:100%">
                                  <tr>
                                      <td>
                                          {{ titem.title }}
                                      </td>
                                      <td align="right" v-if="usrtype">
                                          <el-button icon="el-icon-refresh" v-if="actionid != '查询专用标记'" @click.native="
                        RadioDefaultValDialog(3, titem.title, tindex)
                      " style="background-color: transparent;color:#333333;font-weight:bold">恢复默认值</el-button>
                                      </td>
                                  </tr>
                              </table>
                          </div>

                          <!-- <hr class="style18" /> -->
                          <table border="0" style="width:100%">
                              <!--内容-->
                              <tr class="scroll_content" v-for="(sitems, sindex) in titem.content" :key="sindex">
                                  <td>
                                      <div v-if="sitems.valuetype == 1">
                                          <!--1 checkbox-->
                                          <table border="0">
                                              <tr @mouseenter="mouseenter(sitems.optioncode)" @mouseleave="mouseleave(sitems.optioncode)" :class="{
                          mouseactive: iindex === sitems.optioncode,
                        }">
                                                  <td align="left" style="width:95px;text-align:center">
                                                      <div v-if="sitems.optionflag == 0" style="color:#BABFCC">
                                                          {{ sitems.optionseq }}
                                                      </div>
                                                      <div v-else-if="sitems.optionflag == 2" style="color:red">
                                                          <b>{{ sitems.optionseq }}</b>
                                                      </div>
                                                      <div v-else>
                                                          {{ sitems.optionseq }}
                                                      </div>
                                                  </td>
                                                  <td style="width:20px">
                                                      <el-checkbox v-model="sitems.optionvalue" :disabled="sitems.optionflag == 0" true-label="1" false-label="0" @change="
                              SaveSetting(
                                sitems.sysno,
                                sitems.optioncode,
                                sitems.optionvalue,
                                sitems
                              )
                            "></el-checkbox>
                                                  </td>
                                                  <td @click="
                            chkcheckbox(
                              sitems.sysno,
                              sitems.optioncode,
                              sitems.optionvalue,
                              sitems
                            )
                          ">
                                                      <div v-if="sitems.optionflag == 0" style="color:#BABFCC">
                                                          <!-- <el-tooltip :content="sitems.description" :disabled="
                                sitems.description == sitems.optionname
                              " placement="top-start" effect="dark"> -->
                                                          <div>
                                                              {{ sitems.optionname }}
                                                          </div>
                                                          <!-- </el-tooltip> -->
                                                      </div>
                                                      <div v-else-if="sitems.optionflag == 2" style="color:red">
                                                          <!-- <el-tooltip :disabled="
                                sitems.description == sitems.optionname
                              " :content="sitems.description" placement="top-start" effect="dark"> -->
                                                          <div>
                                                              <b>{{ sitems.optionname }}</b>
                                                          </div>
                                                          <!-- </el-tooltip> -->
                                                      </div>
                                                      <div v-else>
                                                          <!-- <el-tooltip :content="sitems.description" :disabled="
                                sitems.description == sitems.optionname
                              " placement="top-start" effect="dark"> -->
                                                          <div>
                                                              {{ sitems.optionname }}
                                                          </div>
                                                          <!-- </el-tooltip> -->
                                                      </div>
                                                  </td>
                                                  <td align="right">&nbsp;&nbsp;&nbsp;<i class="el-icon-chat-dot-round" style="color:green;font-size:18px" @click="iconclick(sitems.description)" v-if="
                                sitems.description != sitems.optionname
                              "></i></td>
                                                  <td v-if="sitems.optioncode == 'HOLIDAY6' && SQLKEY!='NBS'">
                                                      <el-button icon="el-icon-cold-drink" @click="btnHoliday">其他不校验检验者审核者的日期维护</el-button>
                                                  </td>
                                              </tr>
                                          </table>
                                      </div>
                                      <div v-else-if="sitems.valuetype == 'color'">
                                          <!--color-->
                                          <table border="0">
                                              <tr @mouseenter="mouseenter(sitems.optioncode)" @mouseleave="mouseleave(sitems.optioncode)" :class="{
                          mouseactive: iindex === sitems.optioncode,
                        }">
                                                  <td align="left" style="width:95px;text-align:center">
                                                      <div v-if="sitems.optionflag == 0" style="color:#BABFCC">
                                                          {{ sitems.optionseq }}
                                                      </div>
                                                      <div v-else-if="sitems.optionflag == 2" style="color:red">
                                                          <b>{{ sitems.optionseq }}</b>
                                                      </div>
                                                      <div v-else>
                                                          {{ sitems.optionseq }}
                                                      </div>
                                                  </td>
                                                  <td style="width:20px">
                                                      <el-color-picker size="mini" v-model="sitems.optionvalue" :disabled="sitems.optionflag == 0" @change="
                              SaveSetting(
                                sitems.sysno,
                                sitems.optioncode,
                                sitems.optionvalue
                              )
                            "></el-color-picker>
                                                  </td>
                                                  <td style="vertical-align:middle;">
                                                      <div v-if="sitems.optionflag == 0" style="color:#BABFCC">
                                                          <!-- <el-tooltip :content="sitems.description" :disabled="
                                sitems.description == sitems.optionname
                              " placement="top-start" effect="dark"> -->
                                                          <div>
                                                              {{ sitems.optionname }}
                                                          </div>
                                                          <!-- </el-tooltip> -->
                                                      </div>
                                                      <div v-else-if="sitems.optionflag == 2" style="color:red">
                                                          <!-- <el-tooltip :disabled="
                                sitems.description == sitems.optionname
                              " :content="sitems.description" placement="top-start" effect="dark"> -->
                                                          <div>
                                                              <b>{{ sitems.optionname }}</b>
                                                          </div>
                                                          <!-- </el-tooltip> -->
                                                      </div>
                                                      <div v-else>
                                                          <!-- <el-tooltip :content="sitems.description" :disabled="
                                sitems.description == sitems.optionname
                              " placement="top-start" effect="dark"> -->
                                                          <div>
                                                              {{ sitems.optionname }}
                                                          </div>
                                                          <!-- </el-tooltip> -->
                                                      </div>
                                                  </td>
                                                  <td align="right">&nbsp;&nbsp;&nbsp;<i class="el-icon-chat-dot-round" style="color:green;font-size:18px" @click="iconclick(sitems.description)" v-if="
                                sitems.description != sitems.optionname
                              "></i></td>
                                              </tr>
                                          </table>
                                      </div>
                                      <div v-else>
                                          <table border="0">
                                              <tr @mouseenter="mouseenter(sitems.optioncode)" @mouseleave="mouseleave(sitems.optioncode)" :class="{
                          mouseactive: iindex === sitems.optioncode,
                        }">
                                                  <td align="center" style="width:95px;text-align:center">
                                                      <div v-if="sitems.optionflag == 0" style="color:#BABFCC">
                                                          <!--禁止-->
                                                          {{ sitems.optionseq }}
                                                      </div>
                                                      <div v-else-if="sitems.optionflag == 2" style="color:red">
                                                          <!--加粗-->
                                                          <b>{{ sitems.optionseq }}</b>
                                                      </div>
                                                      <div v-else>
                                                          <!--正常-->
                                                          {{ sitems.optionseq }}
                                                      </div>
                                                  </td>
                                                  <td style="width:20px"></td>
                                                  <td>
                                                      <div v-if="sitems.optionflag == 0" style="color:#BABFCC">
                                                          <!-- <el-tooltip :content="sitems.description" :disabled="
                                sitems.description == sitems.optionname
                              " placement="top-start" effect="dark"> -->
                                                          <div>
                                                              {{ sitems.optionname }}
                                                              &nbsp;&nbsp;&nbsp;
                                                              <i class="el-icon-chat-dot-round" style="color:green;font-size:18px" @click="iconclick(sitems.description)" v-if="
                                sitems.description != sitems.optionname
                              "></i>
                                                          </div>
                                                          <!-- </el-tooltip> -->
                                                      </div>
                                                      <div v-else-if="sitems.optionflag == 2" style="color:red">
                                                          <!-- <el-tooltip :disabled="
                                sitems.description == sitems.optionname
                              " :content="sitems.description" placement="top-start" effect="dark"> -->
                                                          <div>
                                                              <b>{{ sitems.optionname }}</b>
                                                              &nbsp;&nbsp;&nbsp;
                                                              <i class="el-icon-chat-dot-round" style="color:green;font-size:18px" @click="iconclick(sitems.description)" v-if="
                                sitems.description != sitems.optionname
                              "></i>
                                                          </div>
                                                          <!-- </el-tooltip> -->
                                                      </div>
                                                      <div v-else>
                                                          <!-- <el-tooltip :content="sitems.description" :disabled="
                                sitems.description == sitems.optionname
                              " placement="top-start" effect="dark"> -->
                                                          <div>
                                                              {{ sitems.optionname }}
                                                              &nbsp;&nbsp;&nbsp;
                                                              <i class="el-icon-chat-dot-round" style="color:green;font-size:18px" @click="iconclick(sitems.description)" v-if="
                                sitems.description != sitems.optionname
                              "></i>
                                                          </div>
                                                          <!-- </el-tooltip> -->
                                                      </div>
                                                  </td>
                                              </tr>
                                              <tr>
                                                  <td></td>
                                                  <td></td>
                                                  <td>
                                                      <div v-if="sitems.valuetype == 2">
                                                          <!--2-->
                                                          <table>
                                                              <tr>
                                                                  <td>
                                                                      <el-input v-model="sitems.optionvalue" @input="
                                      btnactivetest(
                                        sitems.optioncode,
                                        sitems.optionvalue
                                      )
                                    " :disabled="sitems.optionflag == 0">
                                                                      </el-input>
                                                                  </td>
                                                                  <td>
                                                                      <el-button :class="sitems.type_en" :disabled="sitems.optionflag == 0" :type="
                                      SitemsOptioncode.indexOf(
                                        sitems.optioncode
                                      ) > -1
                                        ? 'danger'
                                        : ''
                                    " :id="'btnactive_' + sitems.optioncode" @click.native="
                                      SaveSetting(
                                        sitems.sysno,
                                        sitems.optioncode,
                                        sitems.optionvalue
                                      )
                                    ">保存</el-button>
                                                                  </td>
                                                              </tr>
                                                          </table>
                                                      </div>
                                                      <div v-else-if="sitems.valuetype == 3">
                                                          <!--3-->
                                                          <table>
                                                              <tr>
                                                                  <td>
                                                                      <el-select v-model="sitems.optionvalue" filterable @change="
                                      SaveSetting(
                                        sitems.sysno,
                                        sitems.optioncode,
                                        sitems.optionvalue
                                      )
                                    " :disabled="sitems.optionflag == 0" style="width:158px">
                                                                          <el-option v-for="item in sitems.valuelist.split(
                                        '|'
                                      )" :key="item.split(' ')[0]" :label="
                                        item.substring(item.indexOf(' '))
                                      " :value="item.split(' ')[0]">
                                                                          </el-option>
                                                                      </el-select>
                                                                  </td>
                                                              </tr>
                                                          </table>
                                                      </div>
                                                      <div v-else-if="sitems.valuetype == 4">
                                                          <!--4-->
                                                          <table>
                                                              <tr>
                                                                  <td>
                                                                      <el-input v-model="sitems.optionvalue" :disabled="sitems.optionflag == 0" ref="refMutipleSelect" :key="1" placeholder="列表多选双击开窗" readonly @dblclick.native="
                                      DialogMutipleSelect(
                                        sitems.valuelist,
                                        sitems.optionvalue,
                                        sitems.optionname,
                                        sitems.optioncode
                                      )
                                    ">
                                                                      </el-input>
                                                                  </td>
                                                                  <td v-show="false">
                                                                      <el-input :id="
                                      'listmutipleid1_' + sitems.optioncode
                                    " v-model="sitems.sysno"></el-input>
                                                                      <el-input :id="
                                      'listmutipleid2_' + sitems.optioncode
                                    " v-model="sitems.optioncode"></el-input>
                                                                  </td>
                                                              </tr>
                                                          </table>
                                                      </div>
                                                      <div v-else-if="sitems.valuetype == 5">
                                                          <!--5-->
                                                          <!--sql单选-->
                                                          <table>
                                                              <tr>
                                                                  <td>
                                                                      <rm_ddl_SqlSingle :sql="sitems.valuelist" :key="sitems.optioncode+'_'+rptunitval" :keyid="rptunitval" :optionflag="sitems.optionflag" v-model="sitems.optionvalue" ref="refSqlSingle" width="158px" @change="SaveSetting(sitems.sysno,sitems.optioncode,$event)">
                                                                      </rm_ddl_SqlSingle>
                                                                  </td>
                                                              </tr>
                                                          </table>
                                                      </div>
                                                      <div v-else-if="sitems.valuetype == 6">
                                                          <!--6 SQL多选-->
                                                          <table>
                                                              <tr>
                                                                  <td>
                                                                      <el-input v-model="sitems.optionvalue" ref="refSql" :disabled="sitems.optionflag == 0" :key="sitems.optioncode" placeholder="SQL多选双击开窗" readonly @dblclick.native="DialogSql(sitems.valuelist,sitems.optionvalue,sitems.optionname,sitems.optioncode)">
                                                                      </el-input>
                                                                  </td>
                                                                  <td v-show="false">
                                                                      <el-input :id="'sqlmutipleid1_' + sitems.optioncode" v-model="sitems.sysno">
                                                                      </el-input>
                                                                      <el-input :id="'sqlmutipleid2_' + sitems.optioncode" v-model="sitems.optioncode">
                                                                      </el-input>
                                                                  </td>
                                                              </tr>
                                                          </table>
                                                      </div>
                                                      <div v-else-if="sitems.valuetype == 7">
                                                          <!--7-->
                                                          <table>
                                                              <tr>
                                                                  <td>
                                                                      <el-input v-model="sitems.optionvalue" ref="refSort" :disabled="sitems.optionflag == 0" :key="1" placeholder="排序双击开窗" readonly @dblclick.native="
                                      DialogSort(
                                        sitems.valuelist,
                                        sitems.optionvalue,
                                        sitems.optionname,
                                        sitems.optioncode
                                      )
                                    ">
                                                                      </el-input>
                                                                  </td>
                                                                  <td v-show="false">
                                                                      <el-input :id="
                                      'sortmutipleid1_' + sitems.optioncode
                                    " v-model="sitems.sysno"></el-input>
                                                                      <el-input :id="
                                      'sortmutipleid2_' + sitems.optioncode
                                    " v-model="sitems.optioncode"></el-input>
                                                                  </td>
                                                              </tr>
                                                          </table>
                                                      </div>
                                                      <div v-else-if="sitems.valuetype == 'printer'">
                                                          <!--printer-->
                                                          <table>
                                                              <tr>
                                                                  <td>
                                                                      <el-select v-model="sitems.optionvalue" filterable @change="
                                      SaveSetting(
                                        sitems.sysno,
                                        sitems.optioncode,
                                        sitems.optionvalue
                                      )
                                    " :disabled="sitems.optionflag == 0" style="width:158px">
                                                                          <el-option v-for="pitem in printers" :key="pitem" :value="pitem" :label="pitem">
                                                                          </el-option>
                                                                      </el-select>
                                                                  </td>
                                                                  <td v-if="sitems.optioncode != 'PRINTERNAME2'">
                                                                      <rm-print-comm :prnt_type="sitems.valuelist" :prnt_name="sitems.optionvalue" @save="PrintSetingSave($event, sitems)"></rm-print-comm>
                                                                  </td>
                                                              </tr>
                                                          </table>
                                                      </div>
                                                      <div v-else-if="sitems.valuetype == 'design'">
                                                          <!--design-->
                                                          <table>
                                                              <tr>
                                                                  <td>
                                                                      <rm_ddl_Design :sqlval="sitems.valuelist" :key="sitems.optionseq" :optionflag="sitems.optionflag" ref="refDesign" @change="
                                      SaveSetting(
                                        sitems.sysno,
                                        sitems.optioncode,
                                        $event
                                      )
                                    " :value="sitems.optionvalue" width="158px">
                                                                      </rm_ddl_Design>
                                                                  </td>

                                                                  <td></td>
                                                                  <td>
                                                                      <el-button :class="sitems.type_en" :disabled="sitems.optionflag == 0" :id="'btnactive_' + sitems.optioncode" @click.native="
                                      JustifyRptStyle(
                                        sitems.sysno,
                                        sitems.optioncode,
                                        sitems.optionvalue,
                                        sitems.valuelist,
                                        sitems.defaultvalue
                                      )
                                    ">调整样式</el-button>
                                                                  </td>
                                                                  <td>
                                                                      <rm-print-comm :prnt_type="
                                      sitems.valuelist == 'BARCODE.01'
                                        ? 'barcode'
                                        : sitems.valuelist
                                    "></rm-print-comm>
                                                                  </td>
                                                              </tr>
                                                          </table>
                                                      </div>
                                                      <!--upimg-->
                                                      <div v-if="sitems.valuetype == 'upimg'">
                                                          <table>
                                                              <tr>
                                                                  <td></td>
                                                                  <td>
                                                                      <rm-imgupload :data="sitems" :key="imgkey" :SQLKEY="SQLKEY" :OptionClass="OptionClass" :hospcode="hospitalcode" :objectid="rptunitval" :macaddress="macadress" @change="uploadimg"></rm-imgupload>
                                                                  </td>
                                                              </tr>
                                                          </table>
                                                      </div>
                                                      <!--rptunit-->
                                                      <div v-if="sitems.valuetype == 'rptunit'">
                                                          <rm-ddl-rptunit prgno="MNG133" @change="SaveSetting(sitems.sysno,sitems.optioncode,$event)" v-model="sitems.optionvalue" width="200px" v-el-drag-dialog :appendtobody="true" :clearable="true" :close-on-click-modal="false" defaultflag="0"></rm-ddl-rptunit>
                                                      </div>
                                                      <!--instr-->
                                                      <div v-if="sitems.valuetype == 'instr'">
                                                          <rm-ddl-instrument @change="SaveSetting(sitems.sysno,sitems.optioncode,$event)" v-model="sitems.optionvalue" width="200px" v-el-drag-dialog :appendtobody="true" :close-on-click-modal="false" :clearable="true" defaultflag="0"></rm-ddl-instrument>
                                                      </div>
                                                  </td>
                                              </tr>
                                          </table>
                                      </div>
                                  </td>
                              </tr>
                          </table>

                          <!-- <hr style=" height:2px;border:none;border-top:2px groove skyblue;" /> -->
                      </div>
                  </div>
              </div>
          </rm-layout-left>
      </div>
      <!--list多选-->
      <el-dialog :title="ListTitle" :visible.sync="dialogVisible" width="810px" v-el-drag-dialog :close-on-click-modal="false">
          <div style="height:400px;width:100%">
              <div style="float:left;width:350px;height:100%;margin-right:5px">
                  <vxe-grid :toolbar="toolbar" :columns="ListTableColumn" height="auto" header-align="center" :edit-config="{
            trigger: 'click',
            mode: 'cell',
            showStatus: true,
            showIcon: false,
          }" border @cell-dblclick="ListSelectEvent" :data.sync="mutiplelist" show-overflow :select-config="selectConfig" highlight-current-row highlight-hover-row ref="ListxTableLeft" resizable size="mini" stripe>
                      <template v-slot:buttons>
                          <el-input v-model.trim="txtListQuery" placeholder="请输入查询条件" style="width:350px"></el-input>
                      </template>
                  </vxe-grid>
              </div>
              <div style="float:left;width:60px;height:100%;text-align:center">
                  <table style="margin-top:150px">
                      <tr>
                          <td>
                              <el-button class="el-icon-right" @click="ListSelectEvent"></el-button>
                          </td>
                      </tr>
                      <tr>
                          <td>
                              <el-button class="el-icon-back" @click="ListNoSelectEvent"></el-button>
                          </td>
                      </tr>
                      <tr>
                          <td>
                              <el-button class="el-icon-d-arrow-right" @click="ListAllSelect"></el-button>
                          </td>
                      </tr>
                      <tr>
                          <td>
                              <el-button class="el-icon-d-arrow-left" @click="ListAllNoSelect"></el-button>
                          </td>
                      </tr>
                  </table>
              </div>
              <div style="float:left;width:350px;height:100%">
                  <vxe-grid :toolbar="toolbar" :columns="ListTableColumn" height="auto" header-align="center" :edit-config="{
            trigger: 'click',
            mode: 'cell',
            showStatus: true,
            showIcon: false,
          }" border @cell-dblclick="ListNoSelectEvent" @current-change="ListCurrSelectEvent" :data.sync="RightListOptions" show-overflow :select-config="selectConfig" highlight-current-row highlight-hover-row ref="ListxTableRight" resizable size="mini" stripe>
                      <template v-slot:buttons>
                          <el-button @click="dialogVisibleSave" style="margin-left:1px">确定</el-button>
                          <el-button @click="dialogVisible = false" style="margin-left:1px">取消</el-button>
                          <el-button @click="ListTabledatafirst()" style="margin-left:8px">首位</el-button>
                          <el-button @click="ListTabledataup()" style="margin-left:1px">上移</el-button>
                          <el-button @click="ListTabledatadown()" style="margin-left:1px">下移</el-button>
                          <el-button @click="ListTabledatalast()" style="margin-left:1px">末位</el-button>
                      </template>
                  </vxe-grid>
              </div>
          </div>
      </el-dialog>
      <!--移位排序-->
      <el-dialog :title="SortTitle" :visible.sync="dialogSortVisible" width="43%" v-el-drag-dialog :close-on-click-modal="false">
          <div style="height:100%;width:100%">
              <!-- <vxe-grid :toolbar="toolbar" :columns="SortTableColumn" height="auto" header-align="center" :edit-config="{
          trigger: 'click',
          mode: 'cell',
          showStatus: true,
          showIcon: false,
          activeMethod:sortactiveMethod
        }" border @current-change="SortSelectEvent" :data.sync="SortTableData" show-overflow :select-config="selectConfig" highlight-current-row highlight-hover-row ref="xTable1" resizable size="mini" stripe>
              </vxe-grid> -->

              <vxe-table @current-change="SortSelectEvent" :select-config="selectConfig" border resizable show-overflow :data.sync="SortTableData" :edit-config="{trigger: 'click', mode: 'cell'}" size="mini" show-header-overflow highlight-current-row highlight-hover-row stripe>
                  <!-- <vxe-table-column type="index" width="60"></vxe-table-column> -->
                  <vxe-table-column field="data" title="代码" width='100'></vxe-table-column>
                  <vxe-table-column field="display" title="名称" width='150'></vxe-table-column>
                  <vxe-table-column field="displayna" title="简称" :edit-render="{name: 'input', autoselect: true}" width='150'></vxe-table-column>
              </vxe-table>
          </div>

          <div style="float:right;margin:10px 0px 10px 0px">
              <table>
                  <tr>
                      <td>
                          <el-button @click=" tabledatafirst()">首位</el-button>
                      </td>
                      <td>
                          <el-button @click="tabledataup()">上移</el-button>
                      </td>
                      <td>
                          <el-button @click="tabledatadown()">下移</el-button>
                      </td>
                      <td>
                          <el-button @click="tabledatalast()">末位</el-button>
                      </td>
                      <td>
                          <el-button @click="dialogSortVisibleSave">确 定</el-button>
                      </td>
                      <td>
                          <el-button @click="dialogSortVisible = false">取 消</el-button>
                      </td>
                  </tr>
              </table>
          </div>

      </el-dialog>
      <!--sql多选-->
      <el-dialog :title="SqlTitle" :visible.sync="SqlDialogVisible" width="940px" v-el-drag-dialog :close-on-click-modal="false">
          <div style="height:430px;width:100%;text-align:center">
              <rm-layout-left splitcolor="white" movingcolor="#00ffff" :splitwidth=5 :fixsize=420 :minfixsize=80 :canDrag=false>
                  <template v-slot:fix>

                      <vxe-grid :toolbar="toolbar" :columns="tableColumn" height="auto" header-align="center" :edit-config="{trigger: 'click',mode: 'cell',showStatus: true,showIcon: false}" border @cell-dblclick="SQLSelectEvent" :data.sync="list" show-overflow :select-config="selectConfig" highlight-current-row highlight-hover-row ref="PopxTableLeft" resizable size="mini" stripe>
                          <template v-slot:buttons>
                              <div style="width:100%">
                                  <div v-if="OptFilterObj.havefilter">
                                      <table style="width:100%;font-size:12px;white-space: nowrap;">
                                          <tr>
                                              <td>快速检索</td>
                                              <td>
                                                  <el-input v-model.trim="txtSqlListQuery" placeholder="请输入代码|名称|输入码" style="width:100%" clearable></el-input>
                                              </td>
                                              <td>{{OptFilterObj.filterName}}</td>
                                              <td>
                                                  <el-select v-model="OptFilterObj.filterValue" clearable placeholder="请选择">
                                                      <el-option v-for="(item,index) in OptFilterObj.filterOptions" :key="index" :label="item" :value="item">
                                                      </el-option>
                                                  </el-select>
                                              </td>
                                          </tr>
                                      </table>
                                  </div>
                                  <div v-else>
                                      <el-input v-model.trim="txtSqlListQuery" placeholder="请输入查询条件" style="width:420px"></el-input>
                                  </div>
                              </div>
                          </template>
                      </vxe-grid>

                  </template>
                  <rm-layout-right splitcolor="white" movingcolor="#00ffff" :splitwidth=5 :fixsize=420>
                      <template v-slot:fix>
                          <div style="height:100%">
                              <vxe-grid :toolbar="toolbar" :columns="tableColumn" height="auto" header-align="center" :edit-config="{trigger: 'click',mode: 'cell',showStatus: true,showIcon: false,}" border @cell-dblclick="SQLNoSelectEvent" @current-change="SqlCurrSelectEvent" :data.sync="RightSqlListOptions" show-overflow :select-config="selectConfig" highlight-current-row highlight-hover-row ref="PopxTableRight" resizable size="mini" stripe>
                                  <template v-slot:buttons>
                                      <el-button @click="SqlDialogVisibleSave" style="margin-left:1px">确 定</el-button>
                                      <el-button @click="SqlDialogVisible = false" style="margin-left:1px">取 消</el-button>
                                      <el-button @click="SqlTabledatafirst()" style="margin-left:1px">首位</el-button>
                                      <el-button @click="SqlTabledataup()" style="margin-left:1px">上移</el-button>
                                      <el-button @click="SqlTabledatadown()" style="margin-left:1px">下移</el-button>
                                      <el-button @click="SqlTabledatalast()" style="margin-left:1px">末位</el-button>
                                  </template>
                              </vxe-grid>
                          </div>
                      </template>

                      <div style="height:100%;width:100%;display: flex;justify-content: center;align-items: center;">
                          <table style="width:100%;border-collapse: separate;border-spacing: 5px;">
                              <tr>
                                  <td>
                                      <el-button class="el-icon-right" @click="SQLSelectEvent" style="width:45px"></el-button>
                                  </td>
                              </tr>
                              <tr>
                                  <td>
                                      <el-button class="el-icon-back" @click="SQLNoSelectEvent" style="width:45px"></el-button>
                                  </td>
                              </tr>
                              <tr>
                                  <td>
                                      <el-button class="el-icon-d-arrow-right" @click="SqlAllSelect" style="width:45px"></el-button>
                                  </td>
                              </tr>
                              <tr>
                                  <td>
                                      <el-button class="el-icon-d-arrow-left" @click="SqlAllNoSelect" style="width:45px"></el-button>
                                  </td>
                              </tr>
                          </table>
                      </div>

                  </rm-layout-right>

              </rm-layout-left>
          </div>
      </el-dialog>
      <!--恢复默认值-->
      <el-dialog title="是否恢复默认值？" :visible.sync="RadioDefaultValVisible" width="30%" :close-on-click-modal="false">
          <div ref="deldefaultval" style="color:#0b82fd;font-size:16px">{{ message }}<br></div>
          <div style="color:#f70f0f;font-size:18px;text-indent:2em;margin:5px">加载系统选项默认值是一个很危险的操作，请慎重。<br>确需加载，请输入密码：</div>
          <div>
              <el-input v-model="DefaultValPwd" ref="RefDefaultValPwd"></el-input>
          </div>
          <span slot="footer" class="dialog-footer">
              <el-button type="primary" @click="RadioDefaultValSave">确 定</el-button>
              <el-button @click="RadioDefaultValVisible = false">取 消</el-button>
          </span>
      </el-dialog>
      <!--修改报告单元选项-->
      <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="批量修改报告单元选项" :visible.sync="RptUnitBatchModifyDialog" width="1000px">
          <div style="height:500px;width:100%;position:relative;">
              <div class="pagetop-d">
                  <table style="font-size:12px" class="table1style">
                      <tr>
                          <td>选&nbsp;项&nbsp;查&nbsp;找</td>
                          <td>
                              <el-input v-model="chksearch" placeholder="选项名称，选项序号" ref="refsearch" style="width:160px;"></el-input>
                          </td>
                          <td>
                              <el-button @click.native="modifysave" icon="el-icon-document">保存</el-button>
                          </td>
                          <td>
                              <el-button @click.native="RptUnitBatchModifyDialog = false" icon="el-icon-close">取消</el-button>
                          </td>
                          <td colspan="5">
                              <span style="color:blue;">*选项列表有且只有一个选项时可根据选项类型变成单选输入框或双击多选输入框</span>
                          </td>
                      </tr>
                      <tr>
                          <td>批量修改值</td>
                          <td>
                              <el-select v-if="modifyinputtype == '3'" v-model="modifyval" @dblclick.native="popMultipleChk(modifyval, 'modifyval', modifyOptions, '选项多选选择')" remote filterable clearable style="width:160px;">
                                  <el-option v-for="(item, index) in modifyOptions" :key="index" :value="item.data" :label="item.display"> </el-option>
                              </el-select>
                              <el-select v-else-if="modifyinputtype == '2'" v-model="modifyval" filterable clearable style="width:160px;">
                                  <el-option v-for="(item, index) in modifyOptions" :key="index" :value="item.data" :label="item.display"> </el-option>
                              </el-select>
                              <el-input v-else v-model="modifyval" placeholder="" style="width:160px;"></el-input>
                          </td>
                          <td>
                              <el-button @click.native="btnmodify" icon="el-icon-edit">修改</el-button>
                          </td>
                          <td>
                              <el-button @click.native="btngetAllRptunit">补全所有报告单元</el-button>
                          </td>
                          <td style="width:100px"></td>
                          <td>报告单元</td>
                          <td>
                              <rm-ddl-rptunit prgno="MNG133" v-model="ddlRptunitid" width="200px" v-el-drag-dialog :appendtobody="true" :clearable="true" :close-on-click-modal="false" :multiple_choice="true"></rm-ddl-rptunit>
                          </td>
                          <td>检验组</td>
                          <td>
                              <rm-ddl-common datatype="labgroup" dataname="检验组" v-model="ddllabgroupid" width="200px" key="3"></rm-ddl-common>
                          </td>
                      </tr>
                  </table>
              </div>
              <div class="pagecenter-d">
                  <div class="middle-center-d">
                      <vxe-table :data.sync="chksearchList" :loading="left_loading" :select-config="{reserve: true}" :sort-config="{trigger: 'cell'}" border height="auto" highlight-current-row highlight-hover-column highlight-hover-row how-header-overflow ref="xTable1" resizable show-overflow size="mini" stripe @current-change="currentChangeEvent">
                          <vxe-table-column field="optionname" title="选项名称 " width="300" header-align="center"></vxe-table-column>
                          <vxe-table-column field="optionkind" title="大类 " width="90" header-align="center"></vxe-table-column>
                          <vxe-table-column field="optiontype" title="小类 " width="90" header-align="center"></vxe-table-column>
                          <vxe-table-column field="optionseq" title="选项序号 " width="80" header-align="center"></vxe-table-column>
                          <!-- <vxe-table-column field="optioncode" title="选项代码 " width="200" header-align="center"></vxe-table-column> -->
                      </vxe-table>
                  </div>
                  <div class="middle-right-d">
                      <vxe-table :data.sync="RptunitidList" :loading="right_loading" :select-config="{reserve: true}" :sort-config="{trigger: 'cell'}" border height="auto" highlight-current-row highlight-hover-column highlight-hover-row how-header-overflow ref="rptunitTable" resizable show-overflow size="mini" stripe :edit-config="{
              trigger: 'click',
              mode: 'cell',
              showStatus: true,
              showIcon: false,
            }" :keyboard-config="{
              isArrow: true,
              isDel: true,
              isEnter: true,
              isTab: true,
              isEdit: true,
            }">
                          <vxe-table-column field="rptunitname" title="报告单元 " width="160" header-align="center">
                              <template v-slot="{row}">
                                  <div>{{ row.rptunitname }} [{{ row.objectid }}]</div>
                              </template>
                          </vxe-table-column>
                          <vxe-table-column field="optionvalue" title="选项取值 " width="88" header-align="center" :edit-render="{name: 'input', autoselect: true}"></vxe-table-column>
                          <vxe-table-column field="optionname" title="选项值名称 " width="130" header-align="center" :edit-render="{name: 'input', autoselect: true}"></vxe-table-column>
                      </vxe-table>
                  </div>
              </div>
          </div>
      </el-dialog>

      <el-dialog :visible.sync="dialogImageVisible">
          <img width="100%" :src="dialogImageUrl" alt="">
      </el-dialog>
      <!-- 节假日维护 -->
      <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="节假日不校验检验者审核者" :visible.sync="bHoliday" width="900px" height="500px">
          <rm-holiday holidaychecktype="ChkSameUser" holidaytitle="节假日不校验检验者审核者"></rm-holiday>
      </el-dialog>
      <!--多选弹窗--->
      <el-dialog width="900px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :title="multichktitle" :visible.sync="dialogMultipleVisible" :destroy-on-close="true">
          <rm-SqlMultiple :leftOption="option1" :rightOption="option2" :name="fieldname" @change="closedialog"></rm-SqlMultiple>
      </el-dialog>
      <!--数据库设置检测弹窗--->
      <el-dialog width="900px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :title="multichktitle" :visible.sync="checkDbVisible" :destroy-on-close="true">
          {{checkDbMsg}}
      </el-dialog>
  </div>
</template>

<script>
import XEUtils from "xe-utils";
import axios from "axios";
import pconst from "../common/printconst.js";
import RmHoliday from "@/components/rmcompents/rm_Holiday.vue";
export default {
  props: {
      URL: { type: String },
      SQLKEY: { type: String },
      OptionClass: { type: String },
      isdialog: { type: Boolean, default: false },
      checkOne: { type: String },
  },
  components: {
      RmHoliday,
  },
  data() {
      return {
          loadstyle: false,
          RptUnitBatchModifyDialog: false,
          left_loading: false,
          right_loading: false,
          ddlRptunitid: "",
          ddllabgroupid: "", //增肌检验工作组过滤
          chksearch: "",
          modifyval: "",
          RptunitOption: [],
          tableData1: [],
          tableData2: [],
          tableData3: [],
          prnt_vertical: "DEVEXPRESS",
          PaperSettingDialog: false,
          PaperSettingDialogOther: false,
          prnt_codetypeOption: [{ label: "CODE128码", value: "128" }],
          prnt_sensorOption: [],
          rptunitval: "0",
          mouseactive: "",
          hospitalname: "",
          hospitalcode: "",
          txtsearch: "",
          macadress: "",
          hostName: "",
          chkRadioDefaultVal: 3,
          loadingContain: false,
          RadioDefaultValVisible: false,
          currentIndex: 0,
          txtSqlListQuery: "",
          txtListQuery: "",
          message: "",
          dialogVisible: false,
          SqlDialogVisible: false,
          actionid: "1 条码编码规则",
          catchScroll: true,
          // checkOne: "1 条码编码规则",
          queryflag: false,
          optionkindOptions: [],
          LeftSqlListOptions: [],
          RightSqlListOptions: [],
          SeachTableColumn: [],
          SeachTableData: [],
          tableColumn: [],
          SqlSingleoptions: [],
          options: [],
          selectConfig: { tigger: "row" },
          nArray: [],
          dialogSortVisible: false,
          SortTableColumn: [],
          SortTableData: [],
          ListTableColumn: [],
          RightListOptions: [],
          LeftListOptions: [],
          prnt_typeOpt: [
              { label: "TSC", value: "tsc" },
              { label: "斑马ZPL指令模式", value: "zebZPL" },
              { label: "128字体模式", value: "code128" },
              { label: "Epl指令模式", value: "epl" },
              { label: "Dev控件打印", value: "BARCODE.01" },
          ],
          prnt_offsetOption: [
              { label: "直印", value: "1" },
              { label: "横印", value: "2" },
          ],
          currRowIndex: 0,
          iindex: 0,
          txtSqlSingleListQuery: "",
          SqlSingleTableColumn: [],
          RightSqlSingleListOptions: [],
          leftSqlSingleListOptions: [],
          ListTitle: "",
          SqlTitle: "",
          SortTitle: "",
          SitemsOptionseq: 0,
          SitemsOptioncode: [],
          left_nav_active: "",
          titleindex: 0,
          listcurrRowIndex: 0,
          sqlcurrRowIndex: 0,
          imgkey: 0,
          prnt_data: {
              prnt_title: "",
              prnt_mac: this.macadress,
              prnt_type: "",
              prnt_fontname: "黑体",
              prnt_vertical: "DEVEXPRESS",
              prnt_name: "",
              prnt_width: "",
              prnt_height: "",
              prnt_xpos: "",
              prnt_ypos: "",
              prnt_thick: "",
              prnt_speed: "",
              prnt_codetype: "",
              prnt_codeheight: "",
              prnt_codeangle: "",
              prnt_codewide: "",
              prnt_narrow: "",
              usedrive: "1",
              prnt_sensor: "",
              prnt_offset: "",
          },
          printers: this.$pub.GetPrinters(),
          labgroupOption: [],
          invOrgOption: [],
          devOrgOption: [],
          bldorgoption: [],
          toolbar: {
              id: "toolbar_demo_2",
              refresh: false,
          },
          uploadurl: "",
          dialogImageUrl: "",
          dialogImageVisible: false,
          OptFilterObj: {
              havefilter: false,
              filterName: "",
              filterValue: "",
              filterOptions: [],
          },
          bHoliday: false,
          modifyOptions: [],
          modifyinputtype: "1", // 1 普通输入框，2 单选输入框，3 多选输入框
          option1: [],
          option2: [],
          fieldname: "",
          multichktitle: "",
          dialogMultipleVisible: false,
          checkDbVisible: false,
          checkDbMsg: "",
          usrtype: this.$tool.getSession(this.$tool.loginutype) == "G",
          DefaultValPwd: "",
      };
  },
  watch: {
      rptunitval(val, oldval) {
          this.rptunitval = val;
      },
  },
  created() {
      this.uploadurl = this.$tool.baseUrl.replace(/api/, "z") + "fileupload";
      //NG133(报告单元)，MNG134（检验仪器）,NG138（无纸化微生物），INV190（采购中心）
      if (this.OptionClass == "普通") {
          this.authorHospital();
          if (this.SQLKEY == "LIS") {
              this.checkDbConfig();
          }
          if (this.SQLKEY == "NBI") {
              this.initbldorg();
          }
      } else if (this.OptionClass == "本地") {
          this.getMacAddress();
      } else {
          //报告单元取到之后在做查询
          if (this.SQLKEY == "INV") {
              this.initInvOrg();
          } else if (this.SQLKEY == "LG") {
              this.initlabgroup();
          } else if (this.SQLKEY == "DEV") {
              this.initDevOrg();
          } else {
              this.ddlInitialList();
          }
          //  this.ddlInitialList();
      }
  },
  mounted() {
      this.$refs.ScrollMainContent.addEventListener("scroll", this.handleScroll);
  },
  destroyed() {
      if (this.$refs.ScrollMainContent) {
          this.$refs.ScrollMainContent.removeEventListener("scroll", this.handleScroll); // 销毁 scroll 事件
      }
  },
  watch: {
      chksearch(val) {
          this.$nextTick(() => {
              var row = this.$refs.xTable1.getCurrentRow();
              if (this.$refs.xTable1.tableData.length > 0) row = this.$refs.xTable1.tableData[0];
              if (row.optioncode) {
                  this.$refs.xTable1.setCurrentRow(row);
                  this.QueryRU(row.optioncode);
              }
          });
      },
      chksearchList(val) {
          //list中只剩一个的时候，看看他是不是列表或者sql,是的话批量修改值由输入框变成选择框
          if (val && val.length == 1) {
              this.GetRUOption(val[0].optioncode);
          } else {
              this.modifyOptions = [];
              this.modifyinputtype = "1"; //普通输入框
          }
      },
  },
  computed: {
      list() {
          //增加过滤条件
          let filterfield = this.OptFilterObj.filterValue;
          let filterName = this.txtSqlListQuery;
          let rest = [];
          if (filterfield) {
              rest = this.LeftSqlListOptions.filter((item) => {
                  return item.filterfield ? item.filterfield.indexOf(filterfield) > -1 : false;
              });
          } else {
              rest = this.LeftSqlListOptions;
          }

          if (filterName) {
              rest = rest.filter((item) => {
                  if (item.hasOwnProperty("inputcode")) {
                      return item.data.toUpperCase().indexOf(filterName.toUpperCase()) > -1 || (item.display ? item.display.indexOf(filterName) > -1 : false) || (item.inputcode ? item.inputcode.toUpperCase().indexOf(filterName.toUpperCase()) > -1 : false);
                  } else {
                      return item.data.toUpperCase().indexOf(filterName.toUpperCase()) > -1 || (item.display ? item.display.indexOf(filterName) > -1 : false);
                  }
              });
          }
          return rest;
          // let filterName = this.txtSqlListQuery;
          // if (filterName) {
          //     let rest = this.LeftSqlListOptions.filter((item) => {
          //         if (item.hasOwnProperty("inputcode")) {
          //             return item.data.toUpperCase().indexOf(filterName.toUpperCase()) > -1 || (item.display ? item.display.indexOf(filterName) > -1 : false) || (item.inputcode ? item.inputcode.toUpperCase().indexOf(filterName.toUpperCase()) > -1 : false);
          //         } else {
          //             return item.data.toUpperCase().indexOf(filterName.toUpperCase()) > -1 || (item.display ? item.display.indexOf(filterName) > -1 : false);
          //         }
          //     });
          //     return rest;
          // } else {
          //     return this.LeftSqlListOptions;
          // }
      },
      mutiplelist() {
          let filterName = this.txtListQuery;
          if (filterName) {
              let rest = this.LeftListOptions.filter((item) => {
                  return item.data.toUpperCase().indexOf(filterName.toUpperCase()) > -1 || (item.display ? item.display.indexOf(filterName) > -1 : false);
              });
              return rest;
          } else {
              return this.LeftListOptions;
          }
      },
      chksearchList() {
          let filterName = this.chksearch;
          if (filterName) {
              let rest = this.tableData1.filter((item) => {
                  return (item.optionname ? item.optionname.indexOf(filterName) > -1 : false) || (item.optionseq ? item.optionseq.indexOf(filterName) > -1 : false);
              });
              return rest;
          } else {
              return this.tableData1;
          }
      },
      RptunitidList() {
          let filterRptunit = this.ddlRptunitid;
          let rest = [];
          if (filterRptunit) {
              rest = this.tableData2.filter((item) => {
                  return item.objectid ? ("," + filterRptunit + ",").indexOf("," + item.objectid + ",") > -1 : false;
              });
          } else {
              rest = this.tableData2;
          }
          let filterLabgroup = this.ddllabgroupid + "";
          if (filterLabgroup.trim() != "") {
              rest = rest.filter((item) => {
                  return item.labgroupid ? item.labgroupid == filterLabgroup : false;
              });
          }
          return rest;
      },
  },
  methods: {
      initlabgroup() {
          this.initData("labgroup")
              .then((res) => {
                  this.labgroupOption = res.Data;
                  if (res.Data.length > 0) {
                      this.rptunitval = res.Data[0].hidkey;
                  } else {
                      this.rptunitval = 0;
                  }
                  this.ddlInitialList();
                  // console.log("wqw", res);
              })
              .catch((e) => {
                  console.log(e, "出错");
              });
      },
      initInvOrg() {
          this.initData("invorg")
              .then((res) => {
                  this.invOrgOption = res.Data;
                  this.rptunitval = this.$tool.getSession(this.$tool.selinvorg) + "";
                  this.ddlInitialList();
              })
              .catch((e) => {
                  console.log(e, "出错");
              });
      },
      initDevOrg() {
          this.initData("devorg")
              .then((res) => {
                  this.devOrgOption = res.Data;
                  this.rptunitval = this.$tool.getSession(this.$tool.seldevorg) + "";
                  this.ddlInitialList();
              })
              .catch((e) => {
                  console.log(e, "出错");
              });
      },
      initbldorg() {
          this.initData("bldorg")
              .then((res) => {
                  console.log(res);
                  this.bldorgoption = res.orglist.Data;
                  this.rptunitval = res.deforg; // this.$tool.getSession(this.$tool.selinvorg);  // 去当前院区默认的供血机构   
                  this.ddlInitialList();
              })
              .catch((e) => {
                  console.log(e, "出错");
              });
      },
      //ibldorgption
      initData(actionindex) {
          return this.$tool.request({
              url: "ucent/ddl",
              method: "post",
              data: {
                  action: actionindex,
              },
          });
      },
      //#region
      handleScroll(e) {
          if (!this.catchScroll) return;
          let _scrollTop = e.target.scrollTop,
              _article = document.querySelectorAll("div.scroll_title");

          for (let i = 0; i < _article.length; i++) {
              if (_scrollTop + 1 >= _article[i].offsetTop) {
                  this.currentIndex = i;
              }
          }

          //低版本浏览器不支持forEach
          // _article.forEach((item, index) => {
          //     if (_scrollTop + 1 >= item.offsetTop) {
          //         this.currentIndex = index;
          //     }
          // });

          if (e.target.scrollTop + 1 >= e.target.scrollHeight - e.target.offsetHeight) {
              //滚动到最后
              this.currentIndex = _article.length - 1;
          }
      },
      goAnchor(index) {
          var that = this;
          this.currentIndex = index; // 把当前点击时获取的 index 赋值给 currentIndex；如果两者相等，则显示高亮
          this.clickIndex = index;
          let anchor = this.$el.querySelector("#anchor-" + index),
              _offsetTop = anchor.offsetTop,
              _scrollTop = this.$refs.ScrollMainContent.scrollTop,
              step = (_offsetTop / 50) >> 0; // 平滑滚动平均分成 50 份，取整

          if (_offsetTop > _scrollTop) {
              anchorDown();
          } else {
              let newOffsetTop = _scrollTop - _offsetTop;
              step = (newOffsetTop / 50) >> 0;
              anchorUp();
          }

          function anchorDown() {
              if (_scrollTop < _offsetTop && step > 0) {
                  _scrollTop += step;
                  that.catchScroll = false;
                  that.$refs.ScrollMainContent.scrollTop = _scrollTop;
                  setTimeout(anchorDown, 10);
              } else {
                  that.catchScroll = true;
                  that.$refs.ScrollMainContent.scrollTop = _offsetTop;
              }
          }
          function anchorUp() {
              if (_scrollTop > _offsetTop && step > 0) {
                  _scrollTop -= step;
                  that.catchScroll = false;
                  that.$refs.ScrollMainContent.scrollTop = _scrollTop;
                  setTimeout(anchorUp, 10);
              } else {
                  that.catchScroll = true;
                  that.$refs.ScrollMainContent.scrollTop = _offsetTop;
              }
          }
      },
      //#endregion
      authorHospital() {
          //显示医院
          this.$tool
              .request({
                  url: this.URL,
                  method: "post",
                  data: {
                      action: "authorHospital",
                  },
              })
              .then((res) => {
                  if (res.Item1 == "1") {
                      if (res.Item2 != "") {
                          this.hospitalname = "当前医院名称：" + res.Item2;
                          this.loadstyle = true;
                      } else {
                          this.hospitalname = "";
                          this.loadstyle = false;
                      }
                      this.hospitalcode = res.Item3;
                      this.ddlInitialList();
                  } else {
                      this.$message({
                          message: "医院单独启用一套选项取值失败" + res.Item2,
                      });
                  }
              })
              .catch((e) => {
                  console.log("error", e);
              });
      },
      ddlInitialList() {
          this.$tool
              .request({
                  url: this.URL,
                  method: "post",
                  data: {
                      action: "ddlInitialList",
                      sqlkey: this.SQLKEY,
                      optionclass: this.OptionClass,
                      hospitalcode: this.hospitalcode,
                  },
              })
              .then((res) => {
                  //  console.log(res);
                  this.optionkindOptions = res;
                  // this.checkOne = res[0].actionid;
                  this.actionid = res[0].actionid;
                  this.InitPageDate(); //初始化主列表
              })
              .catch((e) => {
                  console.log("error", e);
              });
      },
      enterFocus(ele) {
          if (ele == "Refprnt_title") {
              this.$refs.Refprnt_fontname.focus();
          } else if (ele == "Refprnt_fontname") {
              this.$refs.Refprnt_codetype.focus();
          } else if (ele == "Refprnt_codetype") {
              this.$refs.Refprnt_width.focus();
          } else if (ele == "Refprnt_width") {
              this.$refs.Refprnt_height.focus();
          } else if (ele == "Refprnt_height") {
              this.$refs.Refprnt_codeangle.focus();
          } else if (ele == "Refprnt_codeangle") {
              this.$refs.Refprnt_codeheight.focus();
          } else if (ele == "Refprnt_codeheight") {
              this.$refs.Refprnt_xpos.focus();
          } else if (ele == "Refprnt_xpos") {
              this.$refs.Refprnt_ypos.focus();
          } else if (ele == "Refprnt_ypos") {
              this.$refs.Refprnt_speed.focus();
          } else if (ele == "Refprnt_speed") {
              this.$refs.Refprnt_thick.focus();
          } else if (ele == "Refprnt_thick") {
              this.$refs.Refprnt_codewide.focus();
          } else if (ele == "Refprnt_codewide") {
              this.$refs.Refprnt_narrow.focus();
          } else {
          }
      },
      getMacAddress() {
          //获取MAC地址
          if (typeof jsObj != "undefined") {
              var computeInfo = jsObj.GetComputeInfo();
              var arr = computeInfo.split("\r");
              if (arr.length == 3) {
                  var mac = arr[0];
                  this.macadress = mac;
                  //var ip = arr[1];
                  this.hostName = arr[2];
              }
              if (this.macadress != "") {
                  this.hospitalname = "当前MAC地址：" + this.macadress;
                  this.loadstyle = true;
              } else {
                  this.hospitalname = "";
                  this.loadstyle = false;
              }
              if (this.isdialog) {
                  this.actionid = this.checkOne;
                  this.InitPageDate();
              } else {
                  this.ddlInitialList();
              }
          } else {
              this.macadress = "Default";
              this.$alert("获取当前MAC地址出错，请使用" + this.$pub.clientname + ",否则将不能正常操作！", "提示", {
                  confirmButtonText: "确定",
              });
              if (this.isdialog) {
                  this.actionid = this.checkOne;
                  this.InitPageDate();
              } else {
                  this.ddlInitialList();
              }
          }
      },
      InitPageDate() {
          //页面查询
          this.$tool
              .request({
                  url: this.URL,
                  method: "post",
                  data: {
                      action: "InitPageDate",
                      actionid: this.actionid,
                      macadress: this.macadress,
                      sqlkey: this.SQLKEY,
                      optionclass: this.OptionClass,
                      rptunitid: this.rptunitval,
                      hospitalcode: this.hospitalcode,
                  },
              })
              .then((res) => {
                  this.nArray = res; // JSON.parse(res);
              })
              .catch((e) => {
                  console.log("error-InitPageDate", e);
              });
      },
      handleCheckedChange(e) {
          this.actionid = e;
          if (e == "查询专用标记") {
              this.QSecOption();
          } else {
              this.InitPageDate();
          }
      }, //列表多选
      DialogMutipleSelect(data, chkdata, name, seq) {
          this.ListTitle = name;
          this.SitemsOptionseq = seq;
          let dataValue = data.split("|");
          this.RightListOptions = [];
          this.LeftListOptions = [];
          this.ListTableColumn = [
              { field: "data", title: "代码", width: 120 },
              { field: "display", title: "名称", width: 160 },
          ];
          let thisvalue = chkdata.split(",");
          if (thisvalue.length > 0) {
              thisvalue.forEach((item) => {
                  dataValue.forEach((element) => {
                      var kvalue = element.split(" ");
                      if (kvalue[0] == item) {
                          this.RightListOptions.push({
                              display: kvalue[1],
                              data: kvalue[0],
                          });
                      }
                  });
              });
          }
          if (dataValue.length > 0) {
              dataValue.forEach((element) => {
                  var kvalue = element.split(" ");
                  if (thisvalue.indexOf(kvalue[0]) < 0) {
                      this.LeftListOptions.push({
                          display: kvalue[1],
                          data: kvalue[0],
                      });
                  }
              });
          }
          this.dialogVisible = true;
      },
      ListAllSelect() {
          //全选 右移
          let sdata = this.$refs.ListxTableLeft.getTableData().fullData;
          if (sdata.length > 0) {
              sdata.forEach((item) => {
                  let delrow = item;
                  this.$refs.ListxTableLeft.remove(delrow);
                  this.$refs.ListxTableRight.insertAt(delrow, -1);
                  let Rlen = 0;
                  if (this.RightListOptions == null) {
                      this.RightListOptions = [];
                  } else {
                      Rlen = this.RightListOptions.length;
                  }
                  this.RightListOptions.splice(Rlen, 0, delrow);
              });
              this.LeftListOptions = [];
          }
      },
      ListAllNoSelect() {
          //全不选 左移
          let sdata = this.$refs.ListxTableRight.getTableData().fullData;
          if (sdata.length > 0) {
              sdata.forEach((item) => {
                  let delrow = item;
                  this.$refs.ListxTableRight.remove(delrow);
                  this.$refs.ListxTableLeft.insertAt(delrow, -1);
                  this.LeftListOptions.splice(this.LeftListOptions.length, 0, delrow);
              });
              this.RightListOptions = [];
          }
      },
      filterMethod(query, item) {
          return item.label.indexOf(query) > -1;
      },
      ListNoSelectEvent({ row }) {
          try {
              var delrow = this.$refs.ListxTableRight.getCurrentRow();
              if (delrow) {
                  var alld = this.$refs.ListxTableRight.getTableData().fullData;
                  var rowindex = alld.indexOf(delrow);
                  this.$refs.ListxTableRight.remove(delrow);
                  this.$refs.ListxTableLeft.insertAt(delrow, -1);
                  let fdata = delrow.data;
                  let findex = -1;
                  try {
                      this.RightListOptions.forEach((item, index) => {
                          if (fdata == item.data) {
                              findex = index;
                              throw Error();
                          }
                      });
                  } catch (e) {
                      console.log("error", e);
                  }
                  this.RightListOptions.splice(findex, 1);
                  this.LeftListOptions.splice(this.LeftListOptions.length, 0, delrow);
                  let havedata = this.$refs.ListxTableRight.getTableData().fullData;
                  if (havedata.length > 0) {
                      if (rowindex >= havedata.length) rowindex = havedata.length - 1;
                      let selectrow = havedata[rowindex];
                      this.$refs.ListxTableRight.setCurrentRow(selectrow);
                  } else {
                      this.$refs.ListxTableRight.setCurrentRow(null);
                  }
              }
          } catch (e) {
              alert(e);
          }
      },
      ListSelectEvent({ row }) {
          try {
              var delrow = this.$refs.ListxTableLeft.getCurrentRow();
              if (delrow) {
                  var alld = this.$refs.ListxTableLeft.getTableData().fullData;
                  var rowindex = alld.indexOf(delrow);
                  this.$refs.ListxTableLeft.remove(delrow);
                  this.$refs.ListxTableRight.insertAt(delrow, -1);
                  let fdata = delrow.data;
                  let findex = -1;
                  try {
                      this.LeftListOptions.forEach((item, index) => {
                          if (fdata == item.data) {
                              findex = index;
                              throw Error();
                          }
                      });
                  } catch (e) {}
                  this.LeftListOptions.splice(findex, 1);
                  let Rlen = 0;
                  if (this.RightListOptions == null) {
                      this.RightListOptions = [];
                  } else {
                      Rlen = this.RightListOptions.length;
                  }
                  this.RightListOptions.splice(Rlen, 0, delrow);
                  let havedata = this.$refs.ListxTableLeft.getTableData().fullData;
                  if (havedata.length > 0) {
                      if (rowindex >= havedata.length) rowindex = havedata.length - 1;
                      let selectrow = havedata[rowindex];
                      this.$refs.ListxTableLeft.setCurrentRow(selectrow);
                  } else {
                      this.$refs.ListxTableLeft.setCurrentRow(null);
                  }
              }
          } catch (e) {
              alert(e);
          }
      },
      dialogVisibleSave() {
          let ListTable = this.$refs.ListxTableRight.getTableData().fullData;
          let chkdata = "";
          if (ListTable.length > 0) {
              for (let i = 0; i < ListTable.length; i++) {
                  chkdata += ListTable[i].data + ",";
              }
          }
          let kdata = chkdata.substring(0, chkdata.length - 1);

          this.$nextTick(() => {
              this.$refs.refMutipleSelect.value = kdata;
          });

          this.dialogVisible = false;
          let sysno = document.getElementById("listmutipleid1_" + this.SitemsOptionseq).value;
          let optioncode = document.getElementById("listmutipleid2_" + this.SitemsOptionseq).value;
          this.SaveSetting(sysno, optioncode, kdata);
      },
      //排序行选中
      SortSelectEvent({ row, rowIndex }) {
          this.currRowIndex = rowIndex;
      },
      sortactiveMethod({ row, column }) {
          //console.log("saa", column);
          if (column.property == "displayna") {
              return true;
          }
          return false;
      },
      dialogSortVisibleSave() {
          let kdata = "";
          this.SortTableData.forEach((item) => {
              kdata += item.data + ":" + item.displayna + ",";
          });
          kdata = kdata.substring(0, kdata.length - 1);
          this.$nextTick(() => {
              this.$refs.refSort.value = kdata;
          });
          this.dialogSortVisible = false;
          let sysno = document.getElementById("sortmutipleid1_" + this.SitemsOptionseq).value;
          let optioncode = document.getElementById("sortmutipleid2_" + this.SitemsOptionseq).value;
          this.SaveSetting(sysno, optioncode, kdata);
      },
      DialogSort(valuelist, value, name, seq) {
          this.SortTitle = name;
          this.SitemsOptionseq = seq;
          this.SortTableData = [];
          this.SortTableColumn = [
              { field: "data", title: "代码", width: 120 },
              { field: "display", title: "名称", width: 160 },
              { field: "displayna", title: "简称", width: 160 },
          ];
          let NoSortTableData = valuelist.split("|").filter(function (el) {
              return el !== "";
          });

          if (value.trim() == "" || value == null || Number(value) == 0) {
              NoSortTableData.forEach((item) => {
                  let curitem = item.split(" ");
                  let tabledata = { data: curitem[0], display: curitem[1], displayna: curitem[1] };
                  this.SortTableData.push(tabledata);
              });
          } else {
              let valuearr = value.split(",");
              valuearr.forEach((element) => {
                  try {
                      NoSortTableData.forEach((item) => {
                          let curitem = item.split(" ");
                          let elitem = element.split(":");
                          if (elitem[0] == curitem[0]) {
                              let tabledata = {
                                  data: curitem[0],
                                  display: curitem[1],
                                  displayna: elitem[1],
                              };
                              this.SortTableData.push(tabledata);
                              throw Error();
                          }
                      });
                  } catch (e) {}
              });
          }
          this.dialogSortVisible = true;
      },
      //sql多选
      DialogSql(sql, chkdata, name, seq) {
          this.SqlTitle = name;
          this.SitemsOptionseq = seq;
          this.loadingContain = true;
          this.$tool
              .request({
                  url: this.URL,
                  method: "post",
                  data: {
                      action: "SqlInitialList",
                      sql: sql,
                      chkdata: chkdata,
                      keyid: this.rptunitval,
                  },
              })
              .then((res) => {
                  this.OptFilterObj = {
                      havefilter: false,
                      filterName: "",
                      filterOptions: [],
                  };
                  var collist = [{ title: "NO.", type: "index", width: 40 }];
                  for (let i = 0, len = res.RData.Cols.length; i < len; i++) {
                      const item = res.RData.Cols[i];
                      let colitem = {
                          field: item.field,
                          title: item.title,
                          width: item.width,
                      };
                      collist.push(colitem);
                      if (item.field == "filterfield") {
                          this.OptFilterObj.filterName = item.title;
                          this.OptFilterObj.havefilter = true;
                      }
                  }
                  this.tableColumn = collist;
                  this.LeftSqlListOptions = res.LeftGrid;
                  this.RightSqlListOptions = res.RightGrid;
                  //获取本次加载获得的过滤字段
                  if (this.OptFilterObj.havefilter) {
                      this.LeftSqlListOptions.forEach((item) => {
                          let fdata = this.OptFilterObj.filterOptions.find((m) => m == item["filterfield"]);
                          if (!fdata) this.OptFilterObj.filterOptions.push(item["filterfield"]);
                      });
                  }
                  //console.log("tableColumn", this.OptFilterObj);
                  this.txtSqlListQuery = "";
                  this.SqlDialogVisible = true;
                  this.loadingContain = false;
              })
              .catch((e) => {
                  this.$alert(e, "error");
                  this.loadingContain = false;
              });
      },
      SQLSelectEvent() {
          try {
              var delrow = this.$refs.PopxTableLeft.getCurrentRow();
              if (delrow) {
                  var alld = this.$refs.PopxTableLeft.getTableData().fullData;
                  var rowindex = alld.indexOf(delrow);
                  this.$refs.PopxTableLeft.remove(delrow);
                  this.$refs.PopxTableRight.insertAt(delrow, -1);
                  let fdata = delrow.data;
                  let findex = -1;
                  try {
                      this.LeftSqlListOptions.forEach((item, index) => {
                          if (fdata == item.data) {
                              findex = index;
                              throw Error();
                          }
                      });
                  } catch (e) {
                      console.log("error", e);
                  }
                  this.LeftSqlListOptions.splice(findex, 1);
                  let Rlen = 0;
                  if (this.RightSqlListOptions != null) {
                      Rlen = this.RightSqlListOptions.length;
                  } else {
                      this.RightSqlListOptions = [];
                  }
                  this.RightSqlListOptions.splice(Rlen, 0, delrow);
                  let havedata = this.$refs.PopxTableLeft.getTableData().fullData;
                  if (havedata.length > 0) {
                      if (rowindex >= havedata.length) rowindex = havedata.length - 1;
                      let selectrow = havedata[rowindex];
                      this.$refs.PopxTableLeft.setCurrentRow(selectrow);
                  } else {
                      this.$refs.PopxTableLeft.setCurrentRow(null);
                  }
              }
          } catch (e) {
              alert(e);
          }
      },
      SQLNoSelectEvent() {
          try {
              var delrow = this.$refs.PopxTableRight.getCurrentRow();
              if (delrow) {
                  var alld = this.$refs.PopxTableRight.getTableData().fullData;
                  var rowindex = alld.indexOf(delrow);
                  this.$refs.PopxTableRight.remove(delrow);
                  this.$refs.PopxTableLeft.insert(delrow);
                  let fdata = delrow.data;
                  let findex = -1;
                  try {
                      this.RightSqlListOptions.forEach((item, index) => {
                          if (fdata == item.data) {
                              findex = index;
                              throw Error();
                          }
                      });
                  } catch (e) {
                      console.log("error", e);
                  }
                  this.RightSqlListOptions.splice(findex, 1);
                  let Llen = 0;
                  if (this.LeftSqlListOptions != null) {
                      Llen = this.LeftSqlListOptions.length;
                  } else {
                      this.LeftSqlListOptions = [];
                  }
                  this.LeftSqlListOptions.splice(Llen, 0, delrow);
                  let havedata = this.$refs.PopxTableRight.getTableData().fullData;
                  if (havedata.length > 0) {
                      if (rowindex >= havedata.length) rowindex = havedata.length - 1;
                      let selectrow = havedata[rowindex];
                      this.$refs.PopxTableRight.setCurrentRow(selectrow);
                  } else {
                      this.$refs.PopxTableRight.setCurrentRow(null);
                  }
              }
          } catch (e) {
              alert(e);
          }
      },
      SqlAllSelect() {
          //全选 右移
          let sdata = this.$refs.PopxTableLeft.getTableData().fullData;
          if (sdata.length > 0) {
              sdata.forEach((item) => {
                  let delrow = item;
                  this.$refs.PopxTableLeft.remove(delrow);
                  this.$refs.PopxTableRight.insertAt(delrow, -1);
                  let Rlen = 0;
                  if (this.RightSqlListOptions == null) {
                      this.RightSqlListOptions = [];
                  } else {
                      Rlen = this.RightSqlListOptions.length;
                  }
                  this.RightSqlListOptions.splice(Rlen, 0, delrow);
              });
              this.LeftSqlListOptions = [];
          }
      },
      SqlAllNoSelect() {
          //全不选 左移
          let sdata = this.$refs.PopxTableRight.getTableData().fullData;
          if (sdata.length > 0) {
              sdata.forEach((item) => {
                  let delrow = item;
                  this.$refs.PopxTableRight.remove(delrow);
                  this.$refs.PopxTableLeft.insertAt(delrow, -1);
                  let Llen = 0;
                  if (this.LeftSqlListOptions == null) {
                      this.LeftSqlListOptions = [];
                  } else {
                      Llen = this.LeftSqlListOptions.length;
                  }
                  this.LeftSqlListOptions.splice(Llen, 0, delrow);
              });
              this.RightSqlListOptions = [];
          }
      }, //sql多选保存
      SqlDialogVisibleSave() {
          let SqlTable = this.$refs.PopxTableRight.getTableData().fullData;
          let chkdata = "";
          if (SqlTable.length > 0) {
              for (let i = 0; i < SqlTable.length; i++) {
                  chkdata += SqlTable[i].data + ",";
              }
          }
          let kdata = chkdata.substring(0, chkdata.length - 1);
          this.$nextTick(() => {
              this.$refs.refSql[0].value = kdata;
          });
          this.SqlDialogVisible = false;
          let sysno = document.getElementById("sqlmutipleid1_" + this.SitemsOptionseq).value;
          let optioncode = document.getElementById("sqlmutipleid2_" + this.SitemsOptionseq).value;
          this.SaveSetting(sysno, optioncode, kdata);
      },
      GetParam(sysno, optioncode) {
          let keyval = sysno + "_" + optioncode;
          return keyval;
      },
      //选项保存
      SaveSetting(sysno, optioncode, optionvalue, sitems) {
          //只要checkpass是1就弹窗确认
          if (!!sitems && sitems.checkpass == "1") {
              this.$rm_Login({
                  type: "请输入工号和密码",
                  btn: {
                      confirmBtnText: "确定",
                      cancelBtnText: "取消",
                  },
                  optiontxt: sitems.description,
              })
                  .then((res) => {
                      if (res.flag == "1") {
                          this.exeSaveSetting(sysno, optioncode, optionvalue);
                      }
                  })
                  .catch((e) => {
                      this.$pub.message(this, "已取消登录", "warning");
                      if (this.actionid != "查询专用标记") {
                          this.InitPageDate();
                      } else {
                          this.QSecOption();
                      }
                  });
          } else if (sysno == "RU" && this.$pub.validationStart(optioncode, "reg") && this.$pub.validationEnd(optioncode, "_sn")) {
              //申请单未计价审核前不提醒注册码
              this.validationRegister(sysno, optioncode, optionvalue)
                  .then((res) => {
                      //console.log("不提醒注册码", res);
                      if (res.errcode == 0) {
                          this.$alert(res.errmsg, "错误");
                      } else {
                          if (res.errmsg != "") {
                              this.$alert(res.errmsg, "提示");
                          } else {
                              this.$pub.message(this, res.okmsg, "success");
                              this.exeSaveSetting(sysno, optioncode, optionvalue);
                          }
                      }
                  })
                  .catch((e) => {
                      this.$alert(e, "提示");
                  });
          } else {
              this.exeSaveSetting(sysno, optioncode, optionvalue);
          }
      },
      exeSaveSetting(sysno, optioncode, optionvalue) {
          this.$tool
              .request({
                  url: this.URL,
                  method: "post",
                  data: {
                      action: "SaveSetting",
                      sysno: sysno,
                      optioncode: optioncode,
                      optionvalue: optionvalue,
                      macadress: this.macadress,
                      optionclass: this.OptionClass,
                      rptunitid: this.rptunitval,
                      hospitalcode: this.hospitalcode,
                  },
              })
              .then((res) => {
                  if (res.errcode != "1") {
                      this.$message({
                          message: "保存设置失败！" + res.errmsg,
                          type: "error",
                          showClose: true,
                      });
                      if (this.actionid != "查询专用标记") {
                          this.InitPageDate();
                      } else {
                          this.QSecOption();
                      }
                  } else {
                      this.$message({
                          message: "保存设置成功！",
                          type: "success",
                          duration: "1000",
                          showClose: true,
                      });
                      if (this.actionid != "查询专用标记") {
                          this.InitPageDate();
                      } else {
                          this.QSecOption();
                      }
                      this.clearBtnStyle(optioncode, -1, "single");
                  }
              })
              .catch((e) => {
                  console.log("error", e);
              });
      },
      //不提醒注册
      validationRegister(sysno, optioncode, optionvalue) {
          return this.$tool.request({
              // url: "MNG/MNG1/MNG133",
              url: "ucent/ddl",
              method: "post",
              data: {
                  action: "validationRegister",
                  sysno: sysno,
                  optioncode: optioncode,
                  regcode: optionvalue,
                  macadress: this.macadress,
                  optionclass: this.OptionClass,
                  rptunitid: this.rptunitval,
                  hospcode: this.hospitalcode,
              },
          });
      },
      async RadioDefaultValDialog(chkval, optiontype, tindex) {
          let chkTab = "";
          let slidBar = "";
          let tempval = "";
          this.DefaultValPwd = "";
          if (chkval == 1) {
              tempval = "恢复所有选项页";
              chkTab = "ALL";
          } else if (chkval == 2) {
              //B．	加载当前tab页面的默认值
              tempval = "恢复当前页选项";
              chkTab = this.actionid;
          } else {
              //C．	加载当前tab页面的当前小类的默认值
              chkTab = this.actionid;
              tempval = "恢复当前选项的的当前小类";
              slidBar = optiontype; //this.$el.querySelector(".left_nav .active").innerText;
          }

          this.left_nav_active = optiontype;
          this.titleindex = tindex + 1;
          if (this.SQLKEY == "IS") {
              //如果是检验仪器选项
              if (slidBar.trim() == "2 当前仪器") {
                  this.message = "是否要删除本解码的当前仪器设置？删除后重启解码会重新生成当前仪器设置。";
              } else {
                  let res = await this.DefaultValCount(chkval, chkTab, slidBar);
                  if (chkval == 3) {
                      this.message = "确定" + tempval + "(共计：" + res + "条)" + "的默认值吗？";
                  } else {
                      this.message = "确定" + tempval + "(共计：" + res + "条)" + "的默认值吗？若包含[2 当前仪器]选项，则恢复会删除本解码的当前仪器设置,删除后重启解码会重新生成当前仪器设置。";
                  }
              }
          } else {
              //非检验仪器选项
              let res = await this.DefaultValCount(chkval, chkTab, slidBar);
              this.message = "确定" + tempval + "(共计：" + res + "条)" + "的默认值吗？";
          }
          this.RadioDefaultValVisible = true;
          this.chkRadioDefaultVal = chkval;
          setTimeout(() => {
              this.$refs.RefDefaultValPwd.focus();
          }, 10);
      },
      async DefaultValCount(chkval, chkTab, slidBar) {
          try {
              let rowcount = await this.$tool.request({
                  url: this.URL,
                  method: "post",
                  data: {
                      action: "DefaultValCount",
                      chkval: chkval,
                      chkTab: chkTab,
                      slidBar: slidBar,
                      sqlkey: this.SQLKEY,
                      optionclass: this.OptionClass,
                      rptunitid: this.rptunitval,
                      hospitalcode: this.hospitalcode,
                  },
              });
              return rowcount;
          } catch (e) {
              this.$alert(e);
          }
      },
      RadioDefaultValSave() {
          let pwdpassed = false;
          if (!this.DefaultValPwd) {
              this.$alert("请输入密码！", "提示");
          } else {
              let pwd = this.$pub.getPwd();
              if (this.DefaultValPwd == pwd) {
                  pwdpassed = true;
              } else {
                  this.$alert("密码错误！", "提示");
              }
          }
          if (!pwdpassed) return;
          this.RadioDefaultValVisible = false;
          let chkval = this.chkRadioDefaultVal;
          let chkTab = "";
          let slidBar = "";
          let type = "";
          if (chkval == 1) {
              //A．	加载所有tab页面的默认值
              chkTab = "ALL";
              type = "ALL";
          } else if (chkval == 2) {
              //B．	加载当前tab页面的默认值
              chkTab = this.actionid;
              type = "PAll";
          } else {
              //C．	加载当前tab页面的当前小类的默认值
              chkTab = this.actionid;
              slidBar = this.left_nav_active; //this.$el.querySelector(".left_nav .active").innerText;
              type = "type";
          }
          // return false;
          let tindex = this.titleindex;
          this.$tool
              .request({
                  url: this.URL,
                  method: "post",
                  data: {
                      action: "RadioDefaultValSave",
                      chkval: chkval,
                      chkTab: chkTab,
                      slidBar: slidBar,
                      macadress: this.macadress,
                      sqlkey: this.SQLKEY,
                      optionclass: this.OptionClass,
                      rptunitid: this.rptunitval,
                      hospitalcode: this.hospitalcode,
                  },
              })
              .then((res) => {
                  if (res.errcode != "1") {
                      this.$message({
                          message: "恢复默认值失败！" + res.errmsg,
                          type: "error",
                          showClose: true,
                      });
                      if (this.actionid != "查询专用标记") {
                          this.InitPageDate();
                      } else {
                          this.QSecOption();
                      }
                  } else {
                      this.$message({
                          message: "恢复默认值成功！",
                          type: "success",
                          showClose: true,
                      });
                      if (this.actionid != "查询专用标记") {
                          this.InitPageDate();
                      } else {
                          this.QSecOption();
                      }
                      this.clearBtnStyle(-1, tindex, type);
                  }
              })
              .catch((e) => {
                  console.log("error", e);
              });
      },
      QSecOption() {
          this.$tool
              .request({
                  url: this.URL,
                  method: "post",
                  data: {
                      action: "QSecOption",
                      txtsearch: this.txtsearch,
                      macadress: this.macadress,
                      sqlkey: this.SQLKEY,
                      optionclass: this.OptionClass,
                      rptunitid: this.rptunitval,
                      hospitalcode: this.hospitalcode,
                  },
              })
              .then((res) => {
                  if (this.queryflag == false) {
                      this.optionkindOptions.push({
                          actionid: "查询专用标记",
                          actionname: "查询",
                      });
                      this.queryflag = true;
                  }
                  //this.checkOne = "查询专用标记";
                  this.actionid = "查询专用标记";
                  this.nArray = res;
              })
              .catch((e) => {
                  console.log("error-QSecOption", e);
              });
      },
      SqlSingleSelectChange(val) {
          this.$refs.refSqlSingle.value = val;
      },
      //排序移动
      tabledataup() {
          if (this.currRowIndex > 0) {
              let upData = this.SortTableData[this.currRowIndex - 1];
              let currentrow = this.SortTableData[this.currRowIndex];
              this.SortTableData.splice(this.currRowIndex - 1, 1);
              this.SortTableData.splice(this.currRowIndex, 0, upData);
              this.currRowIndex = this.currRowIndex - 1;
              this.$nextTick(() => {
                  this.$refs.xTable1.setCurrentRow(currentrow);
              });
          }
      },
      tabledatadown() {
          if (this.currRowIndex !== this.SortTableData.length - 1) {
              let downData = this.SortTableData[this.currRowIndex + 1];
              let currentrow = this.SortTableData[this.currRowIndex];
              this.SortTableData.splice(this.currRowIndex + 1, 1);
              this.SortTableData.splice(this.currRowIndex, 0, downData);
              this.currRowIndex = this.currRowIndex + 1;
              this.$nextTick(() => {
                  this.$refs.xTable1.setCurrentRow(currentrow);
              });
          }
      },
      tabledatalast() {
          if (this.currRowIndex != this.SortTableData.length - 1) {
              let lastData = this.SortTableData[this.currRowIndex];
              this.SortTableData.splice(this.currRowIndex, 1);
              this.SortTableData.splice(this.SortTableData.length, 0, lastData);
              this.currRowIndex = this.SortTableData.length - 1;
              this.$nextTick(() => {
                  this.$refs.xTable1.setCurrentRow(lastData);
              });
          }
      },
      tabledatafirst() {
          if (this.currRowIndex > 0) {
              let firstData = this.SortTableData[this.currRowIndex];
              this.SortTableData.splice(this.currRowIndex, 1);
              this.SortTableData.splice(0, 0, firstData);
              this.currRowIndex = 0;
              this.$nextTick(() => {
                  this.$refs.xTable1.setCurrentRow(firstData);
              });
          }
      },
      mouseenter(sindex) {
          this.iindex = sindex;
      },
      mouseleave(sindex) {
          this.iindex = -1;
      },
      //列表多选排序
      ListCurrSelectEvent({ rowIndex }) {
          this.listcurrRowIndex = rowIndex;
      },
      ListTabledataup() {
          if (this.listcurrRowIndex > 0) {
              let upData = this.RightListOptions[this.listcurrRowIndex - 1];
              let currentrow = this.RightListOptions[this.listcurrRowIndex];
              this.RightListOptions.splice(this.listcurrRowIndex - 1, 1);
              this.RightListOptions.splice(this.listcurrRowIndex, 0, upData);
              this.listcurrRowIndex = this.listcurrRowIndex - 1;
              this.$nextTick(() => {
                  this.$refs.ListxTableRight.setCurrentRow(currentrow);
              });
          }
      },
      ListTabledatadown() {
          if (this.listcurrRowIndex !== this.RightListOptions.length - 1) {
              let downData = this.RightListOptions[this.listcurrRowIndex + 1];
              let currentrow = this.RightListOptions[this.listcurrRowIndex];
              this.RightListOptions.splice(this.listcurrRowIndex + 1, 1);
              this.RightListOptions.splice(this.listcurrRowIndex, 0, downData);
              this.listcurrRowIndex = this.listcurrRowIndex + 1;
              this.$nextTick(() => {
                  this.$refs.ListxTableRight.setCurrentRow(currentrow);
              });
          }
      },
      ListTabledatalast() {
          if (this.listcurrRowIndex != this.RightListOptions.length - 1) {
              let lastData = this.RightListOptions[this.listcurrRowIndex];
              this.RightListOptions.splice(this.listcurrRowIndex, 1);
              this.RightListOptions.splice(this.RightListOptions.length, 0, lastData);
              this.listcurrRowIndex = this.RightListOptions.length - 1;
              this.$nextTick(() => {
                  this.$refs.ListxTableRight.setCurrentRow(lastData);
              });
          }
      },
      ListTabledatafirst() {
          if (this.listcurrRowIndex > 0) {
              let firstData = this.RightListOptions[this.listcurrRowIndex];
              this.RightListOptions.splice(this.listcurrRowIndex, 1);
              this.RightListOptions.splice(0, 0, firstData);
              this.listcurrRowIndex = 0;
              this.$nextTick(() => {
                  this.$refs.ListxTableRight.setCurrentRow(firstData);
              });
          }
      },
      btnactivetest(code, newval) {
          let kindex = this.SitemsOptioncode.indexOf(code);
          if (kindex < 0) {
              this.SitemsOptioncode.push(code);
          }

          // let btnobj = document.getElementById("btnactive_" + code);
          //btnobj.style.color = "#66b1ff";
      },
      clearBtnStyle(optioncode, optiontype, cleartype) {
          if (cleartype == "single") {
              //单个保存
              let kindex = this.SitemsOptioncode.indexOf(optioncode);
              this.SitemsOptioncode.splice(kindex, 1);
              //document.getElementById("btnactive_" + optioncode).style.background = "#5E6267";
          } else if (cleartype == "type") {
              //选项下小类恢复默认值
              let btnobj = document.getElementsByClassName("btnactive_" + optiontype);
              if (btnobj.length > 0) {
                  for (let i = 0; i < btnobj.length; i++) {
                      //btnobj[i].style.color = "#5E6267";
                      this.SitemsOptioncode = "code";
                  }
              }
          } else {
              //其他
              let btnobj = document.getElementsByTagName("button");
              if (btnobj.length > 0) {
                  for (let i = 0; i < btnobj.length; i++) {
                      if (btnobj[i].id.indexOf("btnactive_") > -1) {
                          //btnobj[i].style.color = "#5E6267";
                          this.SitemsOptioncode = "code";
                      }
                  }
              }
          }
      },
      //SQL多选排序
      SqlCurrSelectEvent({ rowIndex }) {
          this.sqlcurrRowIndex = rowIndex;
      },
      SqlTabledataup() {
          if (this.sqlcurrRowIndex > 0) {
              let upData = this.RightSqlListOptions[this.sqlcurrRowIndex - 1];
              let currentrow = this.RightSqlListOptions[this.sqlcurrRowIndex];
              this.RightSqlListOptions.splice(this.sqlcurrRowIndex - 1, 1);
              this.RightSqlListOptions.splice(this.sqlcurrRowIndex, 0, upData);
              this.sqlcurrRowIndex = this.sqlcurrRowIndex - 1;
              this.$nextTick(() => {
                  this.$refs.PopxTableRight.setCurrentRow(currentrow);
              });
          }
      },
      SqlTabledatadown() {
          if (this.sqlcurrRowIndex !== this.RightSqlListOptions.length - 1) {
              let downData = this.RightSqlListOptions[this.sqlcurrRowIndex + 1];
              let currentrow = this.RightSqlListOptions[this.sqlcurrRowIndex];
              this.RightSqlListOptions.splice(this.sqlcurrRowIndex + 1, 1);
              this.RightSqlListOptions.splice(this.sqlcurrRowIndex, 0, downData);
              this.sqlcurrRowIndex = this.sqlcurrRowIndex + 1;
              this.$nextTick(() => {
                  this.$refs.PopxTableRight.setCurrentRow(currentrow);
              });
          }
      },
      SqlTabledatalast() {
          if (this.sqlcurrRowIndex != this.RightSqlListOptions.length - 1) {
              let lastData = this.RightSqlListOptions[this.sqlcurrRowIndex];
              this.RightSqlListOptions.splice(this.sqlcurrRowIndex, 1);
              this.RightSqlListOptions.splice(this.RightSqlListOptions.length, 0, lastData);
              this.sqlcurrRowIndex = this.RightSqlListOptions.length - 1;
              this.$nextTick(() => {
                  this.$refs.PopxTableRight.setCurrentRow(lastData);
              });
          }
      },
      SqlTabledatafirst() {
          if (this.sqlcurrRowIndex > 0) {
              let firstData = this.RightSqlListOptions[this.sqlcurrRowIndex];
              this.RightSqlListOptions.splice(this.sqlcurrRowIndex, 1);
              this.RightSqlListOptions.splice(0, 0, firstData);
              this.sqlcurrRowIndex = 0;
              this.$nextTick(() => {
                  this.$refs.PopxTableRight.setCurrentRow(firstData);
              });
          }
      },
      chkcheckbox(sysno, optioncode, optionvalue, sitems) {
          //sitems包含了这条数据的所有列
          let arrval = [null, "", "0"];
          if (arrval.indexOf(optionvalue.trim()) > -1) {
              optionvalue = "0";
          }
          let chkvalue = optionvalue == "0" ? "1" : "0";
          this.SaveSetting(sysno, optioncode, chkvalue, sitems);
      }, //报告单元
      rptunitchange(code, name) {
          this.rptunitval = code;
          this.InitPageDate();
      }, //检验仪器
      labinstrumentchange(code, name) {
          this.rptunitval = code;
          this.InitPageDate();
      }, //检验组
      labgroupchange(code, name) {
          this.rptunitval = code;
          this.InitPageDate();
      },
      //点击打开样式进行调整 利用defaultvalue传递样式调整默认JSON
      JustifyRptStyle(sysno, optioncode, optionvalue, valuelist, defaultvalue) {
          let dbtype = this.$ddldata.DbType;
          if (typeof jsObj == "undefined") {
              this.$alert("请使用" + this.$pub.clientname + "打开系统", "错误", {
                  confirmButtonText: "确定",
              });
              return;
          }
          if (valuelist == "BARCODE.01") {
              //条码打印
              this.$pub.printbarcode(this, "", "3", optionvalue);
          } else if (valuelist == "BARCODE.02") {
              //回执单打印
              this.$pub.printbackbar(this, "", "3", optionvalue);
          } else if (valuelist == "BARCODE.03") {
              //科内条码打印
              this.$pub.printbarcode(this, "", "3", optionvalue);
          } else if (valuelist == "BARCODE.04") {
              //包条码打印
              this.$pub.packageBarPrint(this, optionvalue);
          } else if (valuelist == "BARCODE.05") {
              //细菌培养条码标签样式
              this.$pub.printMediumbarcode(this, "design", "3", optionvalue, "", 0, 0, 0, 1);
          } else if (valuelist == "BARCODE.06") {
              //细菌库标签样式
              if (typeof jsObj != "undefined") {
                  let str = JSON.stringify(this.$col.BactBarCol);
                  str += "\r";
                  str += JSON.stringify(this.$col.BactBarData);
                  let sql = btoa(encodeURIComponent(str));
                  jsObj.SetCustomJsonPrintConfig(optionvalue, sql, this.$tool.getSession(this.$tool.loginusername), "细菌库样本登记条码样式");
              } else {
                  this.$alert("请使用" + this.$pub.clientname + "打开系统", "错误", {
                      confirmButtonText: "确定",
                  });
              }
          }else if(valuelist == "BARCODE.07") {
              //样本库条码登记样式
              if (typeof jsObj != "undefined") {
                  let str = JSON.stringify(this.$col.SmpBarCol);
                  str += "\r";
                  str += JSON.stringify(this.$col.SmpBarData);
                  let sql = btoa(encodeURIComponent(str));
                  jsObj.SetCustomJsonPrintConfig(optionvalue, sql, this.$tool.getSession(this.$tool.loginusername), "样本库样本登记条码样式");
              }else{
                  this.$alert("请使用" + this.$pub.clientname + "打开系统", "错误", {
                      confirmButtonText: "确定",
                  });
              }
          }else if (valuelist == "GERMSHEET") {
              //细菌流程单
              this.$pub.printgermsheet(this, "design", optionvalue, "3");
          } else if (valuelist == "LIS.02") {
              //无纸化微生物流程单
              this.$pub.designstyle(this, optionvalue, "LIS.02");
          } else if (valuelist == "InputSampleList") {
              //核收清单样式
              let str = JSON.stringify(this.$col.collectCol);
              str += "\r";
              let data = this.$col.collectData;
              str += JSON.stringify(data);
              let sql = btoa(encodeURIComponent(str));
              jsObj.SetCustomJsonPrintConfig(optionvalue, sql, this.$tool.getSession(this.$tool.loginuserno), "打印清单");
          } else if (valuelist == "BARCODE.SMP221.IN") {
              //样本登记条码样式
              let str = JSON.stringify(this.$col.SmpRegBarColumn);
              str += "\r";
              let data = this.$col.SmpRegBarData;
              str += JSON.stringify(data);
              let sql = btoa(encodeURIComponent(str));
              jsObj.SetCustomJsonPrintConfig(optionvalue, sql, this.$tool.getSession(this.$tool.loginusername), "登记样本条码设计");
          } else if (valuelist == "BARCODE.bctcf" || valuelist == "BARCODE.bctzz" || valuelist == "BARCODE.bctwatch" || valuelist == "BARCODE.bctmed" || valuelist == "BARCODE.bctjd" || valuelist == "BARCODE.SMEAR") {
              //细菌培养条码标签样式
              var barkind = 2;
              if (valuelist == "BARCODE.bctcf") {
                  barkind = 2;
              }
              if (valuelist == "BARCODE.bctzz") {
                  barkind = 3;
              }
              if (valuelist == "BARCODE.bctwatch") {
                  barkind = 4;
              }
              if (valuelist == "BARCODE.bctmed") {
                  barkind = 5;
              }
              if (valuelist == "BARCODE.bctjd") {
                  barkind = 5;
              }
              if (valuelist == "BARCODE.SMEAR") {
                  barkind = 7;
              }
              //barkind 1：接收分配培养基标签样式  2、纯分  3 转种  4：菌落观察菌落标签样式 5：菌落观察补药敏上机标签样式 6:补打分纯标签
              this.$pub.printMediumbarcode(this, "design", "3", optionvalue, "", 0, 0, 0, barkind);
          } else if (valuelist == "BARCODE.INV.B") {
              if (typeof jsObj != "undefined") {
                  let str = JSON.stringify(this.$col.invBarColumn);
                  str += "\r";
                  str += JSON.stringify(this.$col.invBarData);
                  let sql = btoa(encodeURIComponent(str));
                  jsObj.SetCustomJsonPrintConfig(optionvalue, sql, this.$tool.getSession(this.$tool.loginusername), "批次条码样式");
              } else {
                  this.$alert("请使用" + this.$pub.clientname + "打开系统", "错误", {
                      confirmButtonText: "确定",
                  });
              }
          } else if (valuelist == "BARCODE.DEV.B") {
              if (typeof jsObj != "undefined") {
                  let str = JSON.stringify(this.$col.devBarColumn);
                  str += "\r";
                  str += JSON.stringify(this.$col.devBarData);
                  let sql = btoa(encodeURIComponent(str));
                  jsObj.SetCustomJsonPrintConfig(optionvalue, sql, this.$tool.getSession(this.$tool.loginusername), "设备物资条码样式");
              } else {
                  this.$alert("请使用" + this.$pub.clientname + "打开系统", "错误", {
                      confirmButtonText: "确定",
                  });
              }
          } else if (valuelist == "QCLIST") {
              //质控清单打印样式
              var sql = "sp_getQcPrintinfo 'instrid:0','qcdate1:2001-01-01','qcdate2:2001-01-01','qcitem:','batchno:','qclevel:0','labgroupid:','qcdataid:','opertype:2'";
              this.$pub.printlistbill(this, sql, "3", optionvalue, "质控清单", "");
          } else if (valuelist == "QCINCONTROLLABLERPT") {
              //失控报表样式
              var sql = "sp_getQcPrintinfo 'instrid:0','qcdate1:2001-01-01','qcdate2:2001-01-01','qcitem:','batchno:','qclevel:0','labgroupid:','qcdataid:','opertype:2'";
              this.$pub.printlistbill(this, sql, "3", optionvalue, "失控报表", "");
          } else if (valuelist == "REQBILL") {
              //检验申请单样式
              var sql = "select top 1 * from req_master_all_name";
              if (dbtype == "2") {
                  sql = "select  * from req_master_all_name  limit 1";
              } else if (dbtype == "3") {
                  sql = "select  * from req_master_all_name  where rownum = 1";
              }
              this.$pub.printlistbill(this, sql, "3", optionvalue, "检验申请单样式", "");
          } else if (valuelist == "REQRCVLIST") {
              //签收清单样式
              let str = JSON.stringify(this.$col.MasterColumn);
              str += "\r";
              let data = this.$col.MasterData;
              str += JSON.stringify(data);
              let sql = btoa(encodeURIComponent(str));
              jsObj.SetCustomJsonPrintConfig(optionvalue, sql, this.$tool.getSession(this.$tool.loginusername), "签收清单样式");
          } else if (valuelist == "REQOUTLIST") {
              //外送清单样式
              this.$pub.printlistbill(this, "SP_Print_ReqOut 'barcodes:design','senduser:管理员','outids:'", "3", optionvalue, "外送清单", "");
          } else if (valuelist == "SENDRLIST") {
              //送达清单样式
              let sql = "select top 1 1 as 条数, '1' as 序号 ,* from req_master_all_name";
              if (dbtype == "2") {
                  sql = "select  1 as 条数, '1' as 序号 , * from req_master_all_name  limit 1";
              } else if (dbtype == "3") {
                  sql = "select 1 as 条数, '1' as 序号 , req_master_all_name.* from req_master_all_name  where rownum = 1";
              }
              this.$pub.printlistbill(this, sql, "3", optionvalue, "送达清单样式", "");
          } else if (valuelist == "REQBACKLIST") {
              //LIS213,LIS218退回清单样式
              let sql = "select top 1 1 as 条数, '1' as 序号 ,* from req_master_all_name";
              if (dbtype == "2") {
                  sql = "select  1 as 条数, '1' as 序号 , * from req_master_all_name  limit 1";
              } else if (dbtype == "3") {
                  sql = "select 1 as 条数, '1' as 序号 , req_master_all_name.* from req_master_all_name  where rownum = 1";
              }
              this.$pub.printlistbill(this, sql, "3", optionvalue, "退回清单样式", "");
          } else if (valuelist == "REQCIRCLIST") {
              //LIS222标本流转打包清单样式
              let sql = "select top 10 1 as 条数,20998230 as 交接批号,* from req_master_all_name";
              if (dbtype == "2") {
                  sql = "select  1 as 条数, '1' as 序号 , 20998230 as 交接批号,* from req_master_all_name  limit 10";
              } else if (dbtype == "3") {
                  sql = "select 1 as 条数, '1' as 序号 , 20998230 as 交接批号,req_master_all_name.* from req_master_all_name  where rownum < 10";
              }

              this.$pub.printlistbill(this, sql, "3", optionvalue, "流转打包清单样式", "");
          } else if (valuelist == "REQQUEUE.INPUT") {
              //排队标签样式
              if (typeof jsObj != "undefined") {
                  let str = JSON.stringify(this.$col.QueueBarColumn);
                  str += "\r";
                  str += JSON.stringify(this.$col.QueueBarData);
                  let sql = btoa(encodeURIComponent(str));
                  jsObj.SetCustomJsonPrintConfig(optionvalue, sql, this.$tool.getSession(this.$tool.loginusername), "排队标签样式");
              } else {
                  this.$alert("请使用" + this.$pub.clientname + "打开系统", "错误", {
                      confirmButtonText: "确定",
                  });
              }
          } else if (valuelist == "RESAMPLEBILL") {
              //重新采样通知单样式
              let sql = "select top 1 * from req_master_all_name";
              if (dbtype == "2") {
                  sql = "select  * from req_master_all_name  limit 1";
              } else if (dbtype == "3") {
                  sql = "select * from req_master_all_name  where rownum = 1";
              }
              this.$pub.printlistbill(this, sql, "3", optionvalue, "重新采样通知单样式", "");
          } else if (valuelist == "RptDelayNotice") {
              //报告延迟通知单样式
              let sql = "select top 1 *,'延迟文字xxx' as '延迟内容' from req_master_all_name";
              if (dbtype == "2") {
                  sql = "select  '延迟文字xxx' as '延迟内容', * from req_master_all_name  limit 1";
              } else if (dbtype == "3") {
                  sql = "select  '延迟文字xxx' as '延迟内容',req_master_all_name.* from req_master_all_name  where rownum = 1";
              }
              this.$pub.printlistbill(this, sql, "3", optionvalue, "报告延迟通知单样式", "");
          } else if (valuelist == "FORBIDRPT") {
              //禁止打印报告通知单
              let sql = "select top 1 *,'禁止打印改报告单' as '禁止打印原因'  from req_master_all_name where 1=1 ";
              if (dbtype == "2") {
                  sql = "select  '禁止打印改报告单' as '禁止打印原因',* from req_master_all_name  limit 1";
              } else if (dbtype == "3") {
                  sql = "select '禁止打印改报告单' as '禁止打印原因',req_master_all_name.* from req_master_all_name  where rownum = 1";
              }
              this.$pub.printlistbill(this, sql, "3", optionvalue, "禁止打印报告通知单", "");
          } else if (valuelist == "BACTCULRESULTLIST") {
              //纯分清单样式
              let sql = "sp_print_BactCulResultList 'labgroupid:','bdate:2001-01-01','edate:2020-12-01','specimen:','vaccuser:','chkprint:2','operate:design'";
              this.$pub.printlistbill(this, sql, "3", optionvalue, "纯分清单样式", "");
          } else if (valuelist == "BACTMEASURELIST") {
              //上机清单样式
              let sql = "sp_print_BactMeasureList 'labgroupid:','bdate:2001-01-01','edate:2020-12-01','instrno:','chkprint:2','operate:design'";
              this.$pub.printlistbill(this, sql, "3", optionvalue, "上机清单样式", "");
          } else if (valuelist == "REQSUMMARYLIST") {
              //console.log("optionvalue", optionvalue);
              //总汇表样式
              let sql = "Sp_Print_ReqSummrayList 'sqlwhere:  and lab_report.rptunitid='14' and lab_report.sampledate>='2020-05-19' and lab_report.sampledate<='2020-08-19'','sel_odcutoff:1','operate:'";
              this.$pub.printlistbill(this, sql, "3", optionvalue, "总汇表样式", "");
          } else if (valuelist == "REQPOSITIVELIST") {
              //阳性表样式
              let sql = "sp_print_PositiveList 'sqlwhere:','operate:design'";
              this.$pub.printlistbill(this, sql, "3", optionvalue, "阳性表样式", "");
          } else if (valuelist == "SAMPLEREQITEMSUMLIST") {
              let sql = pconst.SAMPLEREQITEMSUMLIST;
              this.$pub.printlistbillJson(this, sql, "3", optionvalue, "申请项目总汇表清单样式", "");
          } else if (valuelist == "SAMPLERPTITEMSUMLIST") {
              let sql = pconst.SAMPLERPTITEMSUMLIST;
              this.$pub.printlistbillJson(this, sql, "3", optionvalue, "检验项目总汇表清单样式", "");
          } else if (valuelist == "QCMonthlyStat") {
              if (typeof jsObj != "undefined") {
                  let str = JSON.stringify(this.$col.LIS546Column);
                  str += "\r";
                  str += JSON.stringify(this.$col.LIS546Data);
                  let sql = btoa(encodeURIComponent(str));
                  jsObj.SetCustomJsonPrintConfig(optionvalue, sql, this.$tool.getSession(this.$tool.loginusername), "质控月统计报表样式");
              } else {
                  this.$alert("请使用" + this.$pub.clientname + "打开系统", "错误", {
                      confirmButtonText: "确定",
                  });
              }
          } else if (valuelist == "InvFaceOutList") {
              //耗材智能出库清单样式
              // let sql = "SELECT b.inoutcode 出入库单编号,e.username 领用人,b.RechkDate 领用时间,d.warehousename 仓库,c.itemname 商品,a.lotno 批号,c.spec 规格,a.expirydate 有效期,a.qty 数量,a.price 价格,a.amount 金额,a.unit 单位 ,a.itemlotnoid 商品批号批次,a.singlebarcode 商品单品条码 ,a.minunit 最小单位,a.minunitqty 对应最小单位数量,a.reagentcomm 试剂状态 ,a.reagentapp 试剂外观 FROM inv_inoutdetail a INNER JOIN inv_inout b ON a.inoutid=b.inoutid LEFT JOIN inv_item c ON a.itemid=c.itemid LEFT JOIN inv_warehouse d ON b.warehouseid=d.warehouseid LEFT JOIN secsysuser e ON b.RechkUser=e.userno WHERE a.inoutid IN (SELECT TOP 1 inoutid FROM inv_inout where inoutflag='O')";
              //  this.$pub.printlistbill(this, sql, "3", optionvalue, "耗材智能出库清单样式", "")

              if (typeof jsObj != "undefined") {
                  let str = JSON.stringify(this.$col.InvFaceOutColumn);
                  str += "\r";
                  str += JSON.stringify(this.$col.InvFaceOutData);
                  let sql = btoa(encodeURIComponent(str));
                  jsObj.SetCustomJsonPrintConfig(optionvalue, sql, this.$tool.getSession(this.$tool.loginusername), "耗材智能出库清单样式");
              } else {
                  this.$alert("请使用" + this.$pub.clientname + "打开系统", "错误", {
                      confirmButtonText: "确定",
                  });
              }
          } else if (valuelist == "INVUSEBARSTYLE") {
              if (typeof jsObj != "undefined") {
                  let str = JSON.stringify(this.$col.InvUseBarColumn);
                  str += "\r";
                  str += JSON.stringify(this.$col.InvUseBarData);
                  let sql = btoa(encodeURIComponent(str));
                  jsObj.SetCustomJsonPrintConfig(optionvalue, sql, this.$tool.getSession(this.$tool.loginusername), "开瓶瓶贴样式");
              } else {
                  this.$alert("请使用" + this.$pub.clientname + "打开系统", "错误", {
                      confirmButtonText: "确定",
                  });
              }
          } else {
              if (typeof jsObj != "undefined") {
                  //console.log("defaultvalue", defaultvalue);
                  if (defaultvalue) {
                      defaultvalue = defaultvalue.replace("|", "\r");
                      let sql = btoa(encodeURIComponent(defaultvalue));
                      jsObj.SetCustomJsonPrintConfig(optionvalue, sql, this.$tool.getSession(this.$tool.loginusername), "report");
                  } else {
                      this.$alert("没有获取到预设报表数据", "错误", {
                          confirmButtonText: "确定",
                      });
                  }
              } else {
                  this.$alert("请使用" + this.$pub.clientname + "打开系统", "错误", {
                      confirmButtonText: "确定",
                  });
              }
          }
      },
      PrintSetingSave(prntdata, s) {
          s.optionvalue = prntdata.prnt_name;
      },
      //报告单元选项批量修改功能
      RptUnitBatchModify() {
          let _this = this;
          _this.InitRUList();
          _this.chksearch = "";
          _this.modifyval = "";
          _this.ddlRptunitid = "";
          _this.ddllabgroupid = "";
          _this.RptUnitBatchModifyDialog = true;
      },
      async InitRUList() {
          try {
              this.left_loading = true;
              const res = await this.$tool.request({
                  url: "MNG/MNG1/MNG133",
                  method: "post",
                  data: {
                      action: "InitRUList",
                  },
              });
              if (res.data) {
                  this.tableData1 = res.data;
                  this.$refs.xTable1.setCurrentRow(res.data[0]);
                  this.QueryRU(res.data[0].optioncode);
              } else {
                  this.tableData1 = [];
                  this.$refs.xTable1.setCurrentRow(null);
              }
              this.left_loading = false;
          } catch (e) {
              this.left_loading = false;
              console.log("error", e);
          }
      },
      async GetRUOption(optioncode) {
          this.modifyOptions = [];
          const res = await this.$tool.request({
              url: "MNG/MNG1/MNG133",
              method: "post",
              data: {
                  action: "GetRuOption",
                  optioncode: optioncode,
              },
          });
          //是列表或者sql
          if (res.ruoption && res.ruoption.length > 0) {
              //多选
              res.ruoption.forEach((item) => {
                  this.modifyOptions.push({ data: item.Item1, display: item.Item2 });
              });
              console.log(this.modifyOptions);
              if (res.mutioptionflag) {
                  this.modifyinputtype = "3"; //多选输入框
              } else {
                  this.modifyinputtype = "2"; //单选输入框
              }
          } else {
              this.modifyinputtype = "1"; //普通输入框
          }
      },
      popMultipleChk(e, fieldname, option, title) {
          let temp = XEUtils.clone(option, true);
          this.option1 = [];
          this.option2 = [];
          if (e != "") {
              let k = e.split(",");
              k.forEach((item) => {
                  let ndata = temp.find((m) => m.data == item);
                  if (ndata != undefined && ndata != null) {
                      this.option2.push(ndata);
                  }
              });
              temp.forEach((item) => {
                  if (k.indexOf(item.data + "") < 0) {
                      this.option1.push(item);
                  }
              });
          } else {
              this.option1 = temp;
          }
          this.fieldname = fieldname;
          this.multichktitle = title;
          this.dialogMultipleVisible = true;
      },
      closedialog(value, name) {
          if (value != "close") {
              this[name] = value;
          }
          this.dialogMultipleVisible = false;
      },
      async QueryRU(optioncode) {
          try {
              this.right_loading = true;
              const res = await this.$tool.request({
                  url: "MNG/MNG1/MNG133",
                  method: "post",
                  data: {
                      action: "QueryRU",
                      optioncode: optioncode,
                  },
              });
              if (res.data) {
                  this.tableData2 = res.data;
                  this.$refs.rptunitTable.setCurrentRow(res.data[0]);
              } else {
                  this.tableData2 = [];
                  this.$refs.rptunitTable.setCurrentRow(null);
              }
              this.tableData3 = res.noExitRptunit;
              this.right_loading = false;
          } catch (e) {
              this.right_loading = false;
              console.log("error", e);
          }
      },
      //行选中
      currentChangeEvent({ row }) {
          this.QueryRU(row.optioncode);
      },
      //修改
      btnmodify() {
          this.tableData2.forEach((item) => {
              item.optionvalue = this.modifyval;
          });
      },
      //补全
      btngetAllRptunit() {
          this.tableData2 = XEUtils.union(this.tableData2, this.tableData3);
      },
      //保存
      async modifysave() {
          try {
              //let data=this.$refs.
              const res = await this.$tool.request({
                  url: "MNG/MNG1/MNG133",
                  method: "post",
                  data: {
                      action: "SaveRU",
                      data: this.RptunitidList, //this.tableData2,
                  },
              });
              if (res.errcode == "1") {
                  this.$message({
                      message: "保存成功！",
                      type: "success",
                      duration: "1200",
                      showClose: true,
                  });
                  let row = this.$refs.xTable1.getCurrentRow();
                  if (row) {
                      this.QueryRU(row.optioncode);
                  }
              } else {
                  this.$message.error("保存失败！" + res.errmsg);
              }
          } catch (e) {
              this.$message.error(e);
          }
      },
      iconclick(infomation) {
          this.$alert(infomation, "信息", { dangerouslyUseHTMLString: true });
      },
      handelUpP(event, file, fileList) {},
      handelUpE(err, file, fileList) {},
      handelUpS(response, file, fileList) {},
      uploadimg(param) {
          var URL = this.$tool.baseUrl.replace("api", "z") + "fileupload";
          let formData = new FormData();
          formData.append("file", param.file);
          formData.append("action", "seting");
          formData.append("sysno", param.data.sysno);
          formData.append("optioncode", param.data.optioncode);
          formData.append("macadress", this.macadress);
          formData.append("optionclass", this.OptionClass);
          formData.append("rptunitid", this.rptunitval);
          formData.append("hospitalcode", this.hospitalcode);
          axios
              .post(URL, formData, { "Content-Type": "multipart/form-data" })
              .then((res) => {
                  if (res.data.errcode != "1") {
                      this.$pub.message(this, "图片上传失败！" + res.errmsg, "error");
                      if (this.actionid != "查询专用标记") {
                          this.InitPageDate();
                      } else {
                          this.QSecOption();
                      }
                  } else {
                      this.$pub.message(this, "图片上传成功！", "success");
                      param.data.optionvalue = res.data.errmsg;
                      if (this.actionid != "查询专用标记") {
                          setTimeout(() => {
                              this.InitPageDate();
                              this.imgkey++;
                          }, 10);
                      } else {
                          setTimeout(() => {
                              this.QSecOption();
                              this.imgkey++;
                          }, 10);
                      }
                  }
                  //console.log("res", res);
              })
              .catch((e) => {
                  this.$alert(e, "出错");
              });
      },
      btnHoliday() {
          this.bHoliday = true;
      },
      //检测数据库设置
      async checkDbConfig() {
          try {
              const res = await this.$tool.request({
                  url: "MNG/MNG1/MNG131",
                  method: "post",
                  timeout: 600000,
                  data: {
                      action: "CheckDbConfig",
                  },
              });
              if (res.msg != "") {
                  this.checkDbVisible = true;
                  this.checkDbMsg = res.msg;
              }
          } catch (e) {
              this.$message.warning(e);
          }
      },
  },
};
</script>

<style scoped>
.left_nav {
  width: 100%;
  /* text-align: center; */
  border-right: 1px solid #ccc;
  height: 100%;
}
.left_nav div {
  cursor: pointer;
  height: 40px;
  line-height: 40px;
  padding-left: 50px;
}
.left_nav .active {
  background-color: deepskyblue;
}
.right_content {
  text-align: left;
  height: 100%;
  width: 100%;
  overflow: auto;
}
.scroll_title {
  padding: 0px 0px 0px 0px;
  color: #333333;
  background-color: #d6d9da;
  font-size: 14px;
  font-weight: bold;
}
.scroll_content {
  line-height: 30px;
  color: #5e6267;
  font-size: 15px;
  text-decoration: none;
  -webkit-transition: color 0.3s;
  transition: color 0.3s;
  padding-left: 50px;
}

.pagetop {
  width: 100%;
  height: 70px;
  display: -webkit-box;
  -webkit-box-pack: left;
  -webkit-box-align: center;
  border: 1px solid #ccc;
  position: absolute;
  z-index: 99;
}

.pagecenter {
  position: absolute;
  top: 75px;
  width: 100%;
  left: 0;
  bottom: 0px;
  overflow: auto;
  border: 1px solid #ccc;
}
.pagetop1 {
  width: 100%;
  height: 40px;
  display: -webkit-box;
  -webkit-box-pack: left;
  -webkit-box-align: center;
  border: 1px solid #ccc;
  position: absolute;
  z-index: 99;
}

.pagecenter1 {
  position: absolute;
  top: 45px;
  width: 100%;
  left: 0;
  bottom: 0px;
  overflow: auto;
  border: 1px solid #ccc;
}
.pagetop2 {
  width: 100%;
  height: 0px;
  display: -webkit-box;
  -webkit-box-pack: left;
  -webkit-box-align: center;
  border: 1px solid #ccc;
  position: absolute;
  z-index: 99;
}

.pagecenter2 {
  position: absolute;
  top: 5px;
  width: 100%;
  left: 0;
  bottom: 0px;
  overflow: auto;
  border: 1px solid #ccc;
}
.table1style {
  padding-right: 3px;
  padding-left: 3px;
}
.mouseactive {
  color: cornflowerblue;
  cursor: pointer;
}

hr.style18 {
  height: 30px;
  border-style: solid;
  border-color: #8c8b8b;
  border-width: 1px 0 0 0;
  border-radius: 20px;
}
hr.style18:before {
  display: block;
  content: "";
  height: 30px;
  margin-top: -31px;
  border-style: solid;
  border-color: #8c8b8b;
  border-width: 0 0 1px 0;
  border-radius: 20px;
}
.pagetop-d {
  width: 100%;
  height: 65px;
  display: -webkit-box;
  -webkit-box-pack: left;
  -webkit-box-align: center;
  border: 1px solid #ccc;
  position: absolute;
  z-index: 99;
}

.pagecenter-d {
  position: absolute;
  top: 70px;
  width: 100%;
  left: 0;
  bottom: 0px;
  overflow: auto;
}

.middle-center-d {
  position: absolute;
  height: 100%;
  left: 0px;
  right: 405px;
  overflow: auto;
}

.middle-right-d {
  position: absolute;
  height: 100%;
  width: 400px;
  right: 0px;
}
.isActive {
  background-color: #0095d9;
}
/deep/ .el-upload {
  vertical-align: middle;
}
</style>
